Chosen Solution
I just got my phone last year and I’ve never had any sound issues or any issue in general. Recently I lost my earphones so I have a new pair but when I plug it in it plays music out loud and makes this beep noise. I’ve tried to restart my phone, make sure there’s no dust or dirt inside the hole bit but it still makes no difference
Try plugging your headphone in someone else’s working iPhone 7 or 8 or conversely, try another working set of phones in your device. That should help you rule it out. If the problem appears to be with your device, it may be a faulty Lightning Port.