The said issue/problem occurs when too much dirt/dust gets accumulated in analog stick. There are two options to resolve the issue :
1) Sprying WD-40 spray on the Analog Stick, and roatating it in all direction so that entire area is covered and clean of dust.
2) (Please try only if you are willing to so) Disassemble the DS4 and clean the interior will rubbing alcohol.
Option one should resolve your issue.