Hello. Assuming it’s an issue with the headphones and not your phone,it would most likely be a bad speaker,or bad wiring. If you carefully open the speaker cover,usually a plastic snap on part under the ear cushion,you can check if the wires are connected. If any are disconnected,that would be why. If not,it could still be a wiring issue.
You can solder wires.
By the way,you should try another pair of earbuds or headphones if you have one lying around…just to make sure.