This is usually down to an issue called drifting. You should take the controller apart and clean the interior.
Try updating the controller firmware, too. In the accessories app, test the controller buttons.
If this doesn’t work, you might need to get the controller repaired. Otherwise, we recommend ordering a replacement if it’s still under warranty.