Short answer: Stop playing the entire song from the beginning. Instead, isolate the mistake, begin just before it happens, and practise only that small section.
Many beginners fall into the same habit. They play through a song, make a mistake halfway through, stop, sigh, and immediately start again from the beginning. While this may feel productive, it usually slows your progress.
The result is that you become extremely confident playing the first few bars of the song, while the sections that actually need attention remain unreliable.
Practise the Transition, Not the Beginning
Starting over every time avoids the real problem instead of solving it. Mistakes often happen during a chord change, a difficult fingering, or an unfamiliar rhythm.
Rather than replaying everything you already know, stop exactly where the mistake occurs. Begin one or two bars before the difficult passage and continue until just after it. Repeat only that section until it feels comfortable and reliable.
Create Multiple Starting Points
Another useful habit is to divide the song into natural sections such as the verse, chorus, and bridge.
Practise starting directly at the beginning of the chorus or halfway through a verse instead of always beginning at bar one.
Being able to start anywhere in a song gives you a much stronger understanding of its structure. It also makes your practice sessions far more efficient because you’re always working on the parts that need the most attention.