I’ve always heard that until you’re master/GM level, it’s better just to play it out. Your opponent might blunder too, or accidentally stalemate you. At the very least, it’s good practice playing at a disadvantage. I know I’ve blundered huge leads myself, so who knows what’s going to happen?
There’s a psychological thing where we always assume that our opponents in games will never mess up, which makes it feel easy to give up the moment you make a mistake.