the led needs to briefly flash when the signal goes from 0v to 5v then
stay off the entire time, eventually flash again when it goes from 5v
to 0v and so on – Luca Reccia
It sounds like you need an edge detector so that when your signal rises to 5 volts from 0 volts or, when it falls from 5 volts to 0 volts, a pulse is generated. This can be achieved with an exclusive-or gate and an RC delay like this: -

Image cropped from this answer.
You can make the width of the pulse as wide as necessary by making R and C a lot bigger. I would also use a Schmitt-input exclusive-or gate to avoid edge jitter and false triggers.
The output of the exclusive-or gate can drive a lower power LED in series with a suitable resistor to limit current.