How

  1. Select text
  2. Press Command-K
  3. Paste or type the URL

Try this

Link text to a webpage.

Why it works

All macOS versions

Sources
Open full demonstration ↗