Modern aircraft now have a collision prevention system which is meant to prevent midair collisions.
The systems on each aircraft talk directly to each other. It doesn't rely on Air Traffic Control.
Since the signal is louder the closer the other aircraft is, potential conflicts can be prioritized.
The systems exchange information about altitude and course, and where the likely collision might be.
Crucially the systems choose which aircraft is to say climb, and which is to remain at present altitude. Ambiguity of who should do what is a factor in ship-to-ship collisions.
An episode of say "Air Crash Investigation" analysed a crash that took place with an early version of this system.
Crucuially, the warning message given by the system in that accident was so "lethargic" that the pilots chose not to page attention to it.