(ESP): Does it have a switch to turn it off? <- It might be a little faulty and sometimes it flickers.
If not, the ESP depends on the sensors located on the four wheels. A cable ends at the CV joint next to the brake disc. 1st, make sure the sensor is clean and that the sensor itself is clean and the wire isn't frayed or damaged.
2nd, near the handbrake, you should have the lateral displacement sensor. <- If the car's rear end slides, the sensor warns you and the ESP corrects.
3rd, the acceleration sensor, which often, depending on the car, gets its reading from the speedometer.
What I would do once all the sensors are clean, if the problem persists, is disconnect the connector from the displacement sensor and put a 0.3 ohm resistor across the wire to eliminate that sensor by closing the circuit with the resistor.
If the problem disappears, then you know the fault was the displacement sensor.