A line is defined as straight, involves no thickness and extends on each opposing direction infinitely (never ending).

A line segment however is defined as a part of a line. It is a part of the line that connects two definite endpoints.

A ray on the other hand is like a combination of the two wherein one side of it is ended/defined by a point while the opposing side is never ending (extends infinitely).