OP, you're being very vague in your posts.
In a general sense, a PhD and naval aviation are incongruous, insofar as each one is a significant career detour from the other.
You don't mention whether you are currently enrolled or applying in a PhD program. Regardless, if you decide to join the Navy after earning your PhD, you are probably shutting most if not all career doors to utilize your degree when you are finished. A doctoral education is highly specialized and requires you to conduct original research in your discipline in order to stay relevant. By the time you finish with the Navy in 10-12 years, your knowledge will have eroded significantly to the point where it will be virtually impossible for you to come back.
Having a PhD in the military will get you no special treatment and offers no career advantages to you. The job requires a bachelor's degree.
If you decide to do naval aviation first, you will incur some challenges getting into graduate school. Namely, you will have been out of school for 10-12 years and now you have to study for the GRE. You will also likely have gotten married and potentially have children. Having said that, the 9/11 GI bill and your veteran status will make attending a graduate program financially easier on you.
So in a general sense: If this is a "should I apply for Naval Aviation or a PhD program," do naval aviation first and PhD second, understanding that you are taking a detour to your final goal of earning a graduate degree that incurs some challenges. If this is a "I'm in a PhD program and I'm considering being a pilot in the Navy after I graduate," you're going to turn your PhD into a waste of money.
Now, to your specific case: being hospitalized for narcotics abuse disqualifies you from commissioning programs. So you need to move on from the idea of becoming an officer. Even if it's technically possible based on something you found buried in an instruction somewhere, no officer recruiter is going to want to put in the effort to push through a candidate with a history of narcotics abuse.