You have covered a few hidden answers in your question itself.
The point where sex/porn starts affecting your academic/professional life is the point where it has become very too much from normal. That's the point at which you need to sit back, look back, see how to put your life in order, and bring some discipline into your life. It's true for everyone. But in your own life, it has happened more than once, academic/profession affected by distractions, so asking this question itself is a good time to buck up and learn.
You have to focus on your goals. But may be, the goals are not strong enough to pull your attraction. May be govt jobs is a poor goal for you, thats why you are not driven towards them. Then find out what other goal interests you (apart from girls). Or if govt jobs interest you, work like hell for it. The solution for few years of distraction/indiscipline, is next few years of discipline and planned, careful effort.
Don't worry too much about losing your youth and all. You still have many years of it left. You will reach a point where girls don't value your for just looks/biceps/hair et. But also because what you do or what you talk makes sense and appeals to them. Because your caring and emotional approach as a mature fellow appeals to them, (not the hugging and loose romantic caring of puppy love). Also because your performance on bed appeals to them(not the looks when you are going out) . If not, you have to reach there. In any case, whomever you marry or have relationship today, that will be the scenario. Today they will expect looks and everything. But after a few years, they won't bother so much for your looks, once they have seen your dick enough and sucked it enough. Then they are going to seek caring and attention from you, and wanting opportunities to do things together in life, not just fucking together. Everybody reaches that stage. Or they don't know how to reach that stage and find out their marriage/relationship is not working when all the fucking is done and dusted.
So, all of these can wait until you reach a good job and the good maturity of a cool mind and being balanced fellow, who can plan your life and money, job and kids etc.
I am not saying don't have any girls till then. That may be too much from where you stand. May be those good women friends you have, stick to them in a non-sexual fashion for a while. Or keep a girlfriend, spend time with her and fuck her once in a while, but without affecting your goals. But, as you have yourself told in your case, this is already becoming impossible for you, having a girlfriend does interfere with you. So, find a middle way that can accommodate your goals or stay away from serious romance for a couple of years till your life is set.
Life getting set , is also important from the girls angle also. For short-term roaming, cooing and fucking like rabbits, any girl will be okay. But if anybody wants to seriously settle down with you, they'll surely ask the question "Is the guy's life set ?" .
The girl should also ask the question "not only his life set today, tommorrow if there are ups and downs, like loss of job, loss of loved one etc, will the fellow match up and raise above them".
She should also ask the question, "is the fellow stable with girls, will he simply jump and go on fucking every girl he comes his way or will he remain faithful". So, you need to demonstrate all these qualities to any girl with whom you want to settle with seriously.
If the girls are not asking these valid questions, then you know that they are also touch-and-go, fuck-whoever-comes your way types. Or they may blindly believe in your sweet words during fucking and foreplay, and later complain their life is a disaster.
So, first build your life. You only said, first looks were bad, there were no girls, then looks improved, girls came running. Again looks went bad, girls dried up. Now what you did with looks, do with life and job also. Build your life and inner qualities that women find attractive in the long term, then surely the right woman knows how to find you, fuck you and keep you forever.
About porn : If you seriously feel it is hampering your progress, watch the "TEDxJaffa" video by "Ran Gavrieli", on ""why I stopped watching porn". If the link below is not working, google for words within quotes, it's the top result.