Hello,
Is this for any key, or just certain key(s)? If so, which key(s)?
Just to make sure, Go to Settings > Accessibility > Keyboard > make sure filter keys is turned off.
If it is already turned off and it is still doing the same thing, it's essential to test with the onscreen keyboard or a different keyboard via USB or Bluetooth. If the alternative keyboard works, it's certain that the issue is hardware-related.