QMK firmware has a handy feature for this called Tapping Force Hold[1]. If you hold the key normally, it modifies the layout, but if you tap it once (or more) and then hold, you'll get the normal repeating behavior.
Example A:
Hold Backspace => Activates layer overlay
Example B:
Tap Backspace => Input backspace
Hold Backspace => Input held backspace => OS handles repeating as configured