These alerts can appear for a few reasons
The Apple device might have a dirty or damaged charging port
The charging accessory is defective, damaged, or non Apple-certified
The USB charger isn't designed to charge devices.
Step to troubleshoot
Remove any debris from the charging port on the bottom of your device.
Try a different USB cable or charger.
Make sure that you have the latest version of iOS.
Contact Apple Support to set up service.
More info here: