In Joomla! CMS we can in some cases choose whether to use IDs (numbers) in URLs or not.
Why is it better to use IDs? Because it's better for SEO.
When a server processes a request, it is always faster to use the integer type than the string type. ID is integer type, so the request will be processed faster. And this means better SEO.
Preserving the correctness of the link
Example: Just imagine, you have created an article but with mistake in alias, so your article link looks like this:
https://www.your_website.com/5-artisle ("artisle" should be "article")
Such a link was indexed in the search engine and you have corrected it. But because of using numbers in your link, it is not a problem, this article is accessible thanks to number 5.
You can even change it to:
And still no problem here, the article is accessible thanks to number 5. So even if your site is indexed with the wrong URL for some time, it is accessible at all times.
This is not possible for variants without ID (without number). Such a link without ID will just return 404.