Hopefully you have waited a couple days to let it dry it. If it hasn't been a couple days, turn it off and let it dry out. The problem may fix itself (especially in terms of the silent mode switch glitching).
That being said, the bare-bones cheapest thing you could do would be to use some some cheap $3 earbuds with the $9 Apple Lightning port to 3.5mm adapter: https://www.apple.com/shop/product/MMX62AM/A/lightning-to-35-mm-headphone-jack-adapter
This wouldn't cure your silent mode to not glitch, but at least you could make phone calls.
I would consider if you might be able to get one of these lightning jack adapters free from a friend. They used to be included standard until the iPhone 7 or 8 I believe, so lots of people have ones laying around in drawers they never used...but even from Apple the are cheap.