When I plug in my phone, it charges for a minute or so and then stops for a few seconds and then resumes. It also stops fast charging and shows cable charging sometimes.
Check for teh cables or charger problems. If not then get it checked at an official samsung store
The charger is working okay with another phone 🤔