Have a close call/shave

To almost be involved in an accident or incident (but the accident or incident does not happen).

I had a close call this morning when I was almost hit by a car.