Usually the message goes and the issue self resolves after around 30 minutes.
Are you able to see if your phone charges using a wireless charger pad ?
A Samsung Service Centre can take a look to see if it's a charging port malfunction.
Daily Driver > Samsung Galaxy s²² Ultra 256Gb in Phantom Black.
The advice I offer is my own and does not represent Samsung’s position.
I'm here to help. " This is the way. "
I've had the same problem with my S20 plus, I don't care what anyone says, it's a software issue if your phone has been kept dry!
The way to remove the constant warning & get it charging again is to plug it into a running laptop/pc & the warning will go & then you can plug it into your proper charger. Mine hasn't done it for a while until yesterday when I bought a USB c card reader with OTG built in & the moment I stuck it into the phone... Boom, moisture detected! So it's 100 % a software problem.