Overtaking an opponent is a real skill. Some drivers have a natural feel for race craft, others have to learn it.
Usually a pass will start a few corners earlier, start getting yourself into position to pounce a few corners prior to the corner where you know you are strong. If you have the advantage on the corner exit: position yourself to pull alongside on the exit of the bend. If you have the advantage on the corner entry: get the momentum out of the previous corner so you can pull enough alongside to stop them turning in and ‘shutting the door’.
Be creative, don’t just pass in the obvious places, look for somewhere unexpected, and commit to the move. If you try it a bit half-arsed thats when you end up with contact. Make the move and be positive about it.
If you pass them on corner entry be prepared for the other driver to make the crossover and try to repass you by getting a better exit on the inside line. You can see on the video below, Scott McLaughlin makes a better exit from the chicane and launches the car down the inside of Mark Winterbottom, catching Mark a bit unawares as this isn’t a normal passing spot. Mark tries the undercut but Scott parks his car on the apex giving Mark nowhere to go. Mark can only accelerate when Scott goes so the leading car will always have the advantage.