Can't be sure without thorough inspection under microscope. However, your issue is most likely related to IC responsible for your touch. The issue is very common in the newer iPhones, but can still affect older ones depending on impact or water damage. In some cases the actual connector may have issues as well, this should be easily able to be seen with a lit magnifying glass if you don't have a microscope available. Both issues are repairable but may not be worth it for those devices.