Update your post to include full system hardware specs and OS information.
Both are USB connected - correct?
If so, how many other USB devices are in use?
Could be that the PSU is not able to provide consistent or steady power to all of the USB devices in use.
You may need to use an independently powered USB hub to maintain/support keyboard and mouse performance.