Definition: A straight line which links two
points without extending beyond them.

Try this
Adjust the line segment below by dragging an orange dot on an endpoint and see how the segment PQ behaves.

See the figure above. The line segment PQ links the points P and Q.
The points P and Q are called the 'endpoints' of the segment.
The word 'segment' typically means 'a piece' of something, and here it means the piece of
a full
line, which would normally extend to infinity in both directions.

A line segment is one-dimensional. It has a measurable length, but has zero width. If you draw a line segment with a pencil, examination with a microscope would show that the pencil mark has a measurable width. The pencil line is just a way to illustrate the idea on paper. In geometry however, a line segment has no width.

Naming of line segments

Line segments are commonly named in two ways:

By the endpoints.
In the figure above, the line segment would be called PQ because it links the two points P and Q.
Recall that points are usually labelled with single upper-case (capital) letters.
There is a symbol for this which looks like

PQ

.
This is read as "line segment PQ". The bar over the two letters indicates it is a line segment, rather than a line, which goes on forever in both directions.

By a single letter.
The segment above would be called simply "y". By convention, this is usually a single lower case (small) letter.
This method is often used in the naming the sides of
triangles and other
polygons.

Constructions

In the constructions chapter,
there are animated demonstrations of how to perform various constructions
related to line segments using only a compass and straightedge. See:

In another branch of mathematics called coordinate geometry, the points that define a line are located on the plane using their
coordinates - two numbers that show where the point is positioned.
For more on this, see Definition of a Line Segment (Coordinate Geometry).

If we know the coordinates of the two endpoints of a line segment,
we can calculate the distance between them, and so find the length of the line segment.
See Distance between two points (coordinate geometry)