It needs a new charging port, send it back to where you got it from if it's still under warranty and they will replace it, it was a big problem with the S20 series, i had 3 that needed that repair, always saying moisture detected but hadn't been anywhere near water, I thought they had sorted it but obviously not. Makes me laugh that they advertise these as being water proof.
Can't actually be water though if so many aren't water damaged, has to be a fault with the phone. On my 4th S10 replaced by insurance, daughter had same issue with S21. Samsung need to address this problem as customers will look to other brands.