Power off the PlayStation 4
Press the controller reset button
After that, plug in the USB cable (the controller to the console)
Turn the PS4 on.
When the blue light starts flashing on the console, press the PS button on the controller.
It should pair with the console and go back to working like usual.
Or watch this video (if above does not work)
https://www.youtube.com/watch?v=GBpqfhPPJPw