In mathematics, we make a distinction between an object and a measurement taken on that object. In the tradition of mathematicians being careful with their words and notation, this distinction carries over into how we write the names of things. For example:

refers to the segment with endpoints X and Y. The line over the letters tells you that we're talking about a segment, not a line or a ray.

XY, on the other hand, refers to the length of the segment with endpoints X and Y. The lack of segment (or line or ray) markings above the letters changes the meaning. We're no longer talking about the object itself, but about a property of that object (namely, its length).

This distinction continues when comparing segments. We say that two segments are congruent, so we use the segment notation

But we say that two lengths are equal, so we use the length notation
XY = AB
or
XY = 3 inches

The statements and XY = AB convey exactly the same information, but one is talking about segments and the other about lengths.

We make a similar distinction between angles and their measures. Thus, angles are congruent: