If you are looking for a way to do this without sorting, I have a hacky idea:
Create a hidden sprite called “PlaceLine” that is the width of the track
Create a path for that “PlaceLine” sprite to travel backwards along the track in a non-stop loop, really fast, but not so fast that it doesn’t overlap itself between frames.
Create a counter associated with that sprite, maybe an instance variable named “CurrentPlace”
CurrentPlace should start at 1.
During game play whenever PlaceLine Collides with a car assign that car the CurrentPlace value and increment by one. If CurrentPlace is greater than 4, then reset it to 1.
This will only work for cars on the same number of laps, so you could also keep track of the current highest lap (lets call that X), and have PlaceLine runs the course backwards X times looking only for collisions with cars at X laps (decrementing each loop).
That’s probably how I’d do it in GDevelop without JavaScipt.