Hello,
LM2903-Q1, TL331-Q1 datasheet has following explanation of Input Voltage.
Please confirm following understanding from above specification is correct.
When these comparators are used Vcc=5V and both input is 0V to Vcc-2V usually and accidentally 30V is applied to either or both input, device are not damaged.
Best Regards.