If the issue persists, it may be hardware-related. In that case, you'll need to visit an authorized service center to have a technician inspect and repair your phone's speaker.
Apple is expected to list these standalone speaker parts soon on its self-repair service dashboard. The process of replacing a faulty speaker isn’t exactly a cakewalk, but at least DIY ...