It sounds like two separate issues.
A) Plugging the controller into the USB port of the PS4 doesn't charge it.
This could be a bad cable or a bad USB port. Try to isolate the problem by changing cables or pluging something else into the USB port like a cell phone. If it still doesn't work with the new cable and won't charge your cell phone then the problem is the USB port on the PS4. If it works with the cell phone but not the controller, it may be a bad charging port or battery in the controller and you should consider replacing them.
B) Controller keeps losing sync with PS4 even after resetting it.
# Go into the PS4 settings and under Devices remove all PS4 controllers from the list
# Reset the controller using the reset button
# Sync the controller using the PS button