When I'm practicing a piece, I can usually play it over-and-over again from beginning to end without any, or minor, mistakes. However, as I get closer to a performance date (which I seldom do now), I begin to panic slightly and get distracted and my playing begins to rapidly fail, perhaps because I practise more without taking as many breaks.
Usually, if I make one mistake...I'll stop instantly. I always read that if you make a mistake, you should always try to cover it up by continuing, I struggle to do this. When the actual performance arrives, I'm panicking and instead of stopping if I make a mistake, I involuntarily pull a face. LOL...now I very rarely perform, I never considered myself very good anyway as I am self-taught.
So, just shut everything off so you focus completely on the playing and not any distractions. If you have any confidence problems, quickly get over them because they can seriously affect your performance and if you make any minor mistakes, pass them off as part of an improvisation or something and carry on, don't attract attention to them!
If you really struggle with a certain part of a piece, break it down into segments and make sure you can play it perfectly and then build on it so hopefully, the problem disappears.
Hope this helps,
G.W.K