It is possible that your headphone jack is not fitting all the way into the headphone socket. This can happen when lint & dirt build up inside the jack opening and get compressed at the bottom of the socket. Eventually, it gets so compacted or so thick, the jack doesn't fully seat, and the connections to switch tracks, change volume aren't made with the proper section of the headphone jack.
To fix it, if that's the problem (and you don't indeed have defective phones), use a round wooden toothpick that has a sharp point. Pick one that has a strong end, not likely to splinter. Push it all the way in until it bottoms out and move it toward the top (screen side) or toward the back (not side to side). Once you do this several times, you'll notice loosened lint coming out. Don't press too hard on the toothpick or the tip may break. If it starts to weaken, discard it and resume with a new one. I'd advise against using any metal instruments.
It may help to blow into the jack socket from across the top of the phone at 90° from the opening to remove the loosened debris. You can used compressed air, but make sure there is no moisture in it. You can also use plastic microbrushes sold at hobby stores to clean out the loosened debris. You'll need to loosen and clean the jack opening several times (mine took about 12 -15 tries) to get all the compressed material out. Should be like new when you're finished, if your phones are functioning.
You can see the lint at the bottom of the socket if you have very bright illumination and good magnification. If you are able to see it, keep at it until all the debris is gone. Hope that helps.