Sounds like the charger and the headphones are to close together. Either externally, or internally.
Unfortunately, short of not having it plugged in, there really isn't anything you can do to change this issue.
If the phone is still under warranty, contact the manufacturer. It may be a hardware issue that is only on your device and they can replace it for you. Or if it is very new, you could try exchanging it or getting a different phone to avoid the problem.