A few possibilities -
1. Faulty USB cables from the controller to XIM APEX can cause intermittent disconnects. Try a different cable (make sure it supports data).
2. Excessive power draw from the mouse, keyboard and/or controller can cause disconnects. Make sure your controller is fully charged. If that doesn't solve it, consider purchasing a power adapter for the XIM APEX USB hub. It needs to be 5V 3A power adapter ([3.5mm x 1.35mm], center-positive).
3. Some keyboard manufacturers don't have great key rollover support. Razer is one of those brands.
If you're stuck in a strafe or find yourself circling around looking at the ground or sky, I'd go with power and recommend buying an adapter. But try a new controller USB cable first as it's the most common issue affecting XIMs.