It controls crawling, not indexing: a blocked URL can still appear in results if other sites link to it. Use noindex to keep a page out of search results.
Robots.txt is also where site owners allow or block AI crawlers such as GPTBot, ClaudeBot or PerplexityBot.