To differentiate the name of a segment from the name of a line, you could use a small line segment above the letters of the segment's name. For example, you could write the segment as AB with a small line segment above it, while a line would be written simply as the letters without any additional symbols.