Ray AB is the same as Ray BA

That is not true. Rays are directed. Ray AB starts at A, and goes through B.

Line segement AB is the same as line segment BA.