This article explains how to fix PS4 controller drift (analog stick drift). The instructions are for the official Sony DualShock 4 controller, but these troubleshooting tips will also work for third-party controllers.
How to Fix Controller Drift on PS4! PS4 Analog Stick Drift Easily Fix!
If your character or camera keeps moving when you’re not touching the controller, the source of the problem is likely analog stick drift. PS4 controller drift can have two causes:
You can expect general wear and tear from frequent use. If cleaning the controller does not solve the problem, you should have your controller replaced or repaired before taking it apart.
Make sure your controller is turned off and follow the steps below until it works properly.