This ICE tree builds an array that holds the point IDs, sorted by their distance from a null:
Now, here’s how to move the “index in sorted array” and the “distance from null” down to per-point data.
(For clarity, I changed the Show Values to show only for tagged points.)