Thanks for asking your question here! Have you tried cleaning your headphone jack? You can clean your headphone jack with cotton buds and check again if your earphone plug is working again.
If your wired earphones are still not working properly after cleaning the headphone jack, then you need to bring your device to an Authorized Samsung Service Center. You can contact the nearest service center in your area and ask them about the exact price of the parts replacement. Here is the Samsung Service Center Locator website: https://www.samsung.com/ph/support/service-center/?msclkid=72d47e20cf8411ec8ac1394658c823b0