you need a floating value to store entries that are being moved, and a boolean attribute which i shall call changes made.
repeat until NOT changes made
repeat (number of items in list - 1) times.
if get item (current loop count) from list > get item (current loop count + 1)
set float to get item (current loop count) from list
replace item (current loop count) with (get item (current loop count +1)) in list
replace item (current loop count +1) with float in list
set changes made to true
the example assumes that the value being compared is distance and that you want smaller values to the front of the list.
when this function completes, your list should be sorted, I do understand that your list is probably more complex than just a list of distances, but I'm assuming you know how to access the relevant bits of information you need

I personally prefer to use lists of lists, that way the shifting of places within lists is much simpler

copy list, replace list, replace list, shazzam,