Problems merging 2 codes (blinking light and dfplayer)

Do you know how the code should look if using an distance sensor (HC-SR04) instead of the PIR?
I tried several days and night, but can't figure it out.
I can activate an LED with distance, but cant figure out how to activate it for only 6 second for example, when the sensor is still triggered.