In some cases if it's not the cable it can be the controller but we should rule out other variables first.
Could you please share your setup so we can learn more about the issue? Please include both the brand and model.
mouse:
keyboard:
extras: extended usb cables, third party usb hub, usb switch, titan or cronus device?