This is pretty easy to achieve with any SQL database (MySQL, MSSQL, Postgres etc) provided that you have user geocoordinates stored in the database (latitude and longitude)… something like:
select id, name, ..., ($earthRadius * acos( cos( radians($latitude) ) * cos( radians( users.latitude ) ) * cos( radians( users.longitude ) - radians($longitude) ) + sin( radians($latitude) ) * sin( radians( users.latitude ) ) ) ) as distance from users having distance <= $radius order by distance
Depending if you want distance in kilometers or miles, you’d replace
$earthRadius with 6371 or with 3959 if you want it in miles (approximate radius of the Earth in km/mi).
$longitude with currently logged user’s latitude and longitude respectively
$radius with the desired radius (in km/miles depending on what you’ve set for earth radius).
You can also add
limit 100 at the end to limit results to 100 entries for example.
SQL query like this can handle/search millions of entries (users) without (m)any issues.
You can find pretty cheap sql database hosting today. Basically every web hosting offers mysql hosting in their hosting plans.
While not supported out-of-the-box, the project linked in my signature provides easy rest api for sql databases and since it is open source, it can be easily extended to support location-based queries.