Thank you for your replies.
Let me provide more details:
I am using P2K U28B DCC ready locomotive that I got second hand as a DC.
I replaced the dummy plug with Digitrax DH165L0.
I don't know if this locomotive has original LED bulbs or previous owner installed them.
All I can say is that the rear LED was wired backwards with blue wire connected to the LED minus (I corrected this).
LEDs are actually current devices, they need a current limit at 20mA that is commonly achieved by adding a resistor in series like you described.
If "blue" voltage changes, the LED current and brightness change too.
However, LM317L maybe a better way because it can be wired as a current limiter (instead of voltage), current is calculated by using formula 1.25V/R.
It means that out of factory regulators are set to 46mA, and this is way too much for an LED.
Digitrax manual said that its regulators are rated for LED, but I am clearly see that is not a fact.
I replaced the rear LM317 resistor with 62 Ohm and it's Ok now.
Front uses 2 LEDs wired in parallel and it means that each LED uses 23mA, so resistor should be 31 Ohm.
I will take a look to see if I should bypass regulators and wire resistors like you mentioned.
Thank you