Sort/Rank using a value that isn't saved in the database

We get to generate realtime distance of vendors from the customers on the repeating group. This distances aren’t saved on the database because users locations aren’t fixed but we show every user their distance to the vendor. How can we sort/rank this distances from the lowest to the highest because we intend to show the users the closest vendors to them. Thanks