This is done in the first place by keeping meticulous scheduling by the Astro Traffic Control. With normal, peace-time operations there is usually quite a lot of time for ships to reserve place in a queue (wormhole exits/junctions are some distance away and civilian ships require anything from several hours to several days to arrive), so it can be maintained easily both ways (outgoing is easy; incoming traffic will be always communicated beforehand by regular schedule courier boat.
Both directions have their dedicated lanes, so incoming ship passes outgoing ship safely, however, due to destabilizing effect and size of the wormhole aperture of the crossing the ships will rarely pass one other in any distance considered close. Wormhole aperture is basically two-dimensional (think huge disc), so even ships under impeller (which requires dozens of kilometres of distance from another impeller) can do that easy.
If military commander has the authority one can declare Condition Delta, which means that if transit spans multiple wormholes via Junctions, the ships under Condition Delta do not have to exit one wormhole and then enter queue for another wormhole in the Junction, ships proceed directly. In this case wormhole(s) termini are are cleared from all civilian traffic.
It is also helped by the fact that passing through the wormhole destabilizes the entry point for some time, and the more mass to the ship the longer it takes to stabilize back (i.e. 8.5MT superdreadnought causes almost 2 minutes of that delay, though small units - under 1.5MT - causes mere 10 seconds). This adds to the Minimum Interval, so there is time for emergency action if anyone breaks down on exit (there is no issue with failure on entry, ship is just crushed). If anything happens and there's a collision of two ships, when one is late to clear the exit area, there is a huge risk o remains of the collided ships to cause cascading effect, so I assume there are tugs on stand-by to grab and move anything that's stuck out of the way.
Wartime operations are slightly different (but mostly security of the traffic queue and physical ship inspections).
Emergency Operations are a madhouse: ships are sent with literally single-digit seconds between crossings (Peacetime Minimum Interval is 60 seconds) and if any suffers engineering casualty (failure), tough luck if not quick enough to move out of the way ASAP. They're usually declared by military fleet commanders by sending Category One Alpha communications to the local Terminus ACS (in Kingdom of Manticore/Manticoran Empire at least).
Emergency operations allow also for simultaneous crossing, meaning a number of ships enter wormhole at the same time. There is a mass limit on this one (200MT) and it destabilizes wormhole for 17 hours.
More can be found Here and Here.