Two common reasons the charging port needs to be replaced are easily prevented. Wrapping the cable around the phone or holding it a certain way to charge is a clear sign the charging port has considerable debris buildup. Usually pocket lint from cotton blue jeans. Fake Apple cables WILL fry things as well.
The Dock Assembly performs many functions including: Charging port, Primary Microphone, Headphone Jack, Home Button, Cellular Antenna, and Loudspeaker pass-through.
iPhone 8 and 8 Plus Dock Assembly - $95
iPhone 7 and 7 Plus Dock Assembly - $85
iPhone 6S Dock Assembly - $65
iPhone 6S Plus Dock Assembly - $65
iPhone 6 and 6 Plus Dock Assembly - $60
iPhone 5S/5C/5 Dock Assembly - $50