Please note that 横幅 よこはば is a length from left to right. よこ is a word to describe the orientation of things such as in 横向き (facing sideways, lying sideways)、横になる (lying down sideways), and so on.
幅(はば） is width. はば is also a range from one end to the other.
はば is "width" which is the distance/length from one side of something to the other.
はば is not "height."
"Height" is called 高さ or たての長さ.
よこ is a horizontal line.
よこの長さ is the length of the horizontal line, which is the same as はば or "width."
However, よこ can be used for よこの長さ in some context. In this context, よこ and はば means the same.
たて is a vertical line.
たての長さ is the length of the vertical line, which is the same as "length" or 高さ.
And in some cases, you can say just たて instead of たての長さ. We can just say たて simply, for the meaning of たての長さ.
However, if you think of the three-detentions, it becomes more complicated:
X axis is よこ.
Ｙ axis is たて.
Ｚ axis is 高さ.
The length of something in X axis is called よこの長さ or はば, or the width.
The length of something in Y axis is called たての長さ or 奥行の長さ or just 奥行 or the depth.
The length of something in Z axis is called 高さ or height.
We don't say 高さの長さ. We say both "the vertical line" and "the length of vertical line" as 高さ.
たて and 高さ can become confusing, according to which the speaker is talking about, the two-dimensional thing or the three-dimensional thing.