@secretgirl I would not just go ahead and replace the charger just yet. Measure the output of the charger with a multimeter and see if it has the required voltage. If so, not reason to replace it. If is does not then you replace it. After the charger you will have to check the charging port. Check for debris, corrosion, bend pins etc. Clean it with a few drops of 90%+ isopropyl alcohol and a few puffs of canned air. If that does not resolve it you will have to take your Surface apart. There you would need to check your charging port connector as well as the power management IC. Even so this is not a guide, it’ll show you what you are up against. So, start by checking the charger first.
Microsoft Surface Pro 6 Teardown