Sound trigger after measuring distance

I’m working on a project where I calculate the distance between myself and other cyclists during Ragbrai as “The greatest threat to your well-being on the route is not cars or trucks but other cyclists” according to the organizers.

I’m trying to come up with a way to trigger a sound alert (without it being a text message) when another cyclist has come too close. What would be the best way to do this device wise?