A common abuser of this is the Discord desktop app, which listens on a local port.
When your browser navigates to a Discord channel's join page, it sends a request to localhost via this port and sends the channel ID to the client. This lets the app pop open a native 'Join Channel' experience.
I discovered this when I noticed how this behavior worked even in incognito mode and my browser was signed out of Discord.
Not. Cool. We need to massively improve sandboxing - of all applications - in the desktop world.