Ideas
Try to make sure your atleast +1.5-2.0 seconds over delta for hairpins and slow corners as the delta always shoots up at every corner on track you can make this up on straights if needed just take it easy when approaching and during cornering. To get a better feel for it maybe try causing a safety car in grand prix mode at a track your most likely to race on in career or multiplayer and practice the scenario. Hope this helps and also keep a look for the start finish line aswell as it can tend to jump up especially if the race in under a VSC.
Other things you can consider is lower your ERS to NONE and Fuel mix to low (soon as the safety car or vsc as ended fuel automatically goes back to standard) and it also useful if you need to save on fuel.