in case the keyboard is delaying to respond then there is a potential of a frozen motherboard. Therefore, if the motherboard is frozen it would be really simply to fix. All you need to do is to turn the device off for a few minutes and turn it on again.
However, if after the device on the keyboard still hanging, then it could be chance that the motherboard is damaged. Therefore, it would be a better idea to buy a new phone becaseu the motherboard is basically to the whole thing in a device and it will cost a lot comparing the device itself.