Make sure your Surface and its drivers are fully up to date. Microsoft has released firmware patches specifically targeting this issue. Go to Settings → Windows Update → Check for updates, especially display/firmware updates.
Disable Hyper-V
Boot into UEFI (BIOS):
Shut down → hold Volume Up + Power
If flickering still happens there → it’s definitely hardware.
If your device is still under warranty or extended support, you may qualify for a free repair or replacement. Even out of warranty, it's worth contacting Microsoft Support, as they have offered exceptions for this known issue.