I MIGHT HAVE FOUND A SOLUTION EVEYRONE!!
I've been having this issue for months, literally NOTHING I did would fix it. I think its a windows 11 update that doesn't detect the 3.5 mm port when there's headphones plugged in. What I did was go to the Sound settings on the control panel, double click on it and then in the General tab click on the Realtek Audio properties button. Click on 'Change Settings', go to Driver, and click on 'Roll Back Driver'. I'm assuming this roles the driver back to the previous one in Windows 10 or the last Windows update before the faulty one we have now. I'm not sure what restarting the computer will look like, if it'll restore it back to the newer one or not, but it seems to be working and I have sound coming out of my headphones!
I hope this helps