The keyboard response differs depending on what you are using for an app. As an example filling in a form online can be slow as the connection is either not stable or over a slow link. But the keys across the keyboard should respond the same.
Here you are stating a sub set of keys react oddly, I'm suspecting your battery is pressing on the keyboards cable which is interfering with the signal. To prove it you should see a difference between your systems keyboard vs an external keyboard either a Bluetooth or USB connected.
I would install this gem of an app! [https://www.coconut-flavour.com/coconutbattery/|CoconutBattery] take a snapshot of the apps main window and post it here for us to see [guide|21499] so we can see what the batteries state is.