Yes, any change in the order of calculation of floating point values can result in different round off, and sorting is sensitive to the exact floating point representation. You can have the same issue with vectorization compared to looping, and you can have the same issue with parfor compared to for, and you can have the same issue if Mathworks changes the Just In Time (JIT) engine.
The way to avoid this is to do your distance calculations and comparisons in infinite precision. Depending on how you do your calculations, the Symbolic Toolbox might suffice for that. (Be warned that I encountered an calculation about a month ago for which calculating to over 200000 digits was not sufficient.)