When a pair of wired headphones keeps disconnecting and reconnecting it's often a sign that they have internal damage. This could be caused by a number of things, such as the wires being twisted or damaged due to excessive strain or wear and tear. This can also happen if you drop your headphones or they are exposed to water.
It's possible that your headphones are experiencing a signal issue due to noise or interference from other electronic devices such as smartphones, Wi-Fi routers, or microwaves. By maintaining a good distance between your headphones and other electronic devices you can help reduce this type of interference and keep the audio signals stable.
Another reason why your headphones might be cutting out is because the headphone's audio jack or port may be dirty or blocked. This can be solved by gently cleaning the headphone plug and the port with an electronics-safe cleaner or a can of compressed air. It's also possible that the audio settings on your device are not correct and can cause the headphones to disconnect and reconnect frequently.
You can fix this by resetting your audio settings on your device and/or adjusting the equalizer settings. If this doesn't work it's possible that the earphones have a broken wire within them which can be fixed by splitting up the headphone cable, removing the damaged piece and then rejoining the wires together using electrical duct tape. However, if this does not work it's likely that you need a new pair of headphones.