Raycasts have a ton of uses. They just detect colliders, but you can use that information for a variety of purposes. Like you mentioned you could have a text element appear when you are looking at a specific object. Other ways of using them are to detect if you have direct line of sight to an object. For instance in an explosion I may want to use a raycast to detect what objects have direct line of sight to the explosion impact, if so we can apply damage. Anything not detected by a collider will not be damaged.
It’s also use for point and click type mechanics. I’m actually working on an updated version of this course called the “Game Programming Bootcamp” and will contain a few new examples of raycasts being used.