See length, width, height, depth for the use of these terms with two- or three-dimensional objects.
Length is used two ways: it is the name we use for the measure of a one-dimensional object, the name of the one measurement that can be made; when used in connection with two- or three-dimensional objects, its use is more casual.
We call the measure of a one-dimensional object like its length. We can measure the length of one-dimensional objects whether they are "by themselves" (like the segment and squiggles shown above) or part of a 2-D object (e.g., one of the sides of a rectangle or triangle) or a 3-D object (e.g., one edge of a prism or pyramid), and we always refer to that measure as the length of the part (even if it is the width or height of the 2-D or 3-D object).
(compare with "distance")