When racing not everything always goes to plan the key is to settle down back into your running and regain focus on the desired outcome; not worrying about variables you have no control over.
For example, I remember running a 10 mile race in Norfolk a couple of years ago and though in 3rd place knew that second was a possibility with just over 3½ miles to go. As I was approaching a house I remember seeing a hazard sign with ducks on it and at that moment, a family of ducks started to cross the road to the pond opposite. I had to stop to let them cross before resuming the race, with those 30+ seconds feeling like an hour.
The point is you can only worry about the variables you have control over which in this case was run as well as I could for the last few miles. I can’t worry about the ducks, fourth place runner catching me or the second place runner creating a further gap.