If it plays through the headphone jack, but not the speakers it could be one of 3 things. The easiest would be a volume setting where it mutes the whole phone, which I think is overridden by inserting the headphone jacks. Make sure you have volume levels set appropriately and you do NOT have do not disturb enabled. There are several options for DND, the one you'd look for is to turn it on until you turn it off. The others would have timed out by now.
Another problem might also be with the jack itself. If the contacts are dirty it might not reconnect. You could get a small swab (I don't think regular q-tips fit, ad they'd have a tendency to leave cotton fibers behind, which wouldn't be good) and trey cleaning it with a LITTLE alcohol, while the phone is OFF.
If the switch or the speaker itself is broken, then it's time for a hardware fix.