If you see a liquid-detection alert on your MacBook Air or MacBook Pro - Apple Support
In macOS Sequoia or later, when you connect a USB-C cable or accessory, your MacBook Air with M3 or M4 chip, MacBook Pro with M3 Pro or M3 Max chip, or MacBook Pro with M4, M4 Pro, or M4 Max chip can warn you if there's liquid in the port. If you see this alert, your Mac has detected liquid in the USB-C port or on the cable or accessory. -- My personal observation is that I would think that if you look at the cable end you plug into the computer and see it is wet then it will be obvious you should not plug it in.
Unless you literally dumped the charger in a bucket of water, I would think that letting it dry for a day or so would be adequate. We can't tell if anything internal got wet.
If you are really concerned then take it to a Genius Bar and ask them.
Go to this page to find your nearest Apple Authorized Service Provider (AASP) or Apple Authorized Distributor (AAD) --> Find Locations
How to make a Genius Bar appointment
1. Go to Genius Bar Reservation and Apple Support Options - Apple
2. Go to "Get hardware help".
3. Select your hardware and continue selecting options requiring replacing parts until you see "Bring in for Repair"
4. Sign in with your Apple ID
or:
Refer to this document for ways to contact Apple ➞ Choose your country or region - Official Apple Support
Select your country (also look for "other" regions), then a product. If you don't see one that handles your issue then keep experimenting with selections until you reach one that gets you a chat session or a telephone call and get the representative to redirect you.
or:
Contact Apple for support and service by telephone ➞ Contact Apple Support - Apple Support
If you cannot make it to a Genius Bar then once you have let it sit for a day or so, plug the charger alone into a wall socket and see if there are any obvious issues. If you are concerned about that and can't get the charger assessed by APple then buy a new one. They aren't cheap but they are less costly than a new computer.