EPC and engine were intermittent on mine also and so far at least have found it to be electrical. The first thing i checked was the battery voltage level as most modern vehicles will have issues with ABS/EPC/ESP if the battery voltage is at 12.4 V and below. Fixing the battery issue resulted in the EPC and engine light coming on less frequently.
Where I live Rats and Mice are a problem and use the engine for warmth and they like to chew wiring so next step was to check all wiring in the engine bay starting with wiring to the coils. I had the engine running when I checked the coil wiring and first wriggled the connector, then the wires into the connectors. On moving the wires into coil 1 connector the engine ran rougher and when I moved the wires in the opposite direction, the engine idled smoother.
However in all off the vehicles I have repaired recently including 2018 GMC Sierra, 2022 Mazda 3, 2005 and 2007 Ford Falcon and 2012 VW Golf, replacing the Battery has fixed this problem even though the Batteries were at 12.4V when I tested them.