Did you check if your iPhone’s gotten stuck on Bluetooth? Sometimes these things connect to random devices like they’re in an open relationship. Head to Control Center and toggle Bluetooth off. Could also be your usual headphones or earbuds messing with the output. Bluetooth accessories can glitch and keep the volume low even after you’ve disconnected them.
Oh, and speaking of audio settings, don’t sleep on the “Reduce Loud Sounds” option in Settings > Sounds & Haptics (seriously, it’s sneaky). If it’s toggled on, your iPhone might be artificially capping the playback volume. I know @boswandelaar mentioned volume limiters, but this isn’t exactly the same thing.
Last scenario, if you’re sure it’s not gunk in the speakers or a little “fat fingers oops” on the silent switch, there’s a chance this could be hardware acting up. If you’ve dropped your phone or it got introduced to water in any way (yes, even “water-resistant” doesn’t mean invincible), the speaker grill could be damaged. Could require a repair job.
Wouldn’t want to factory reset unless it’s your last resort—way too many horror stories of people losing all their data because they forgot iCloud existed. Keep backups handy, but yeah, maybe head to a trusted tech repair or Apple Store before going nuclear on the settings. Just my 2 cents.