That's great he's off Xanax thoughnin sorry to hear that he has replaced it with heroin. I am not surprised, getting off of benzos is a painful process. It's great that you care so much for your friend but unfortunately there is not much you can do to help him get sober with exception of being supportive (not enabling). Most likely your friend's addiction is a symptom of a larger problem, one that he has to address when he is able and ready to. Is he working with a doctor and/or a counselor? Do you know if he is open to professional help as he has a heavy problem that sounds like it is going to get worse before it gets better.
Personally, my concern is for you. Loving an addict is a painful soul crushing process (I say this as an addict who was very loved by friends and family and my addiction just about killed them). Like I said above, be supportive but please do not lose yourself in his addiction. If he is not receptive to treatment be very careful and protect yourself. Set boundaries and stick to them - I recommend writing those boundaries down so you can refer back to them as time goes on. As he spirals further the down the rabbit hole you will most likely find yourself spending more time and resources trying to help him, thus entering his spiral. After a while you will feel very invested, and the more time you devote to helping him the less likely you will want to pull back when your boundaries get crossed or compromised. This is how friends and family essentially get "addicted" to the addict and begin to lose themselves.
From personal experience on each side, both as the addict and also as the caretaker, I can tell you unequivocally this will not help your friend and it will put an unnecessary amount of stress on you, and it helps no one. I am saying all of this to you as I could see how concerned you were for them when thy were using benzos. Now that they are chasing the dragon the game has changed, and it's probably going to get pretty tough from here on out given your friend's benzo use patterns. Opiates are insidious, heroin is worse. People lose themselves very quickly with that particular substance and I don't want to see you deteriorate because of your friend's problem. P0kemomma gives valid advice - go to a few al-anon meetings and learn how to productively support your friend.
I am so sorry you are going through this. I know how painful it is to watch a loved one self destruct and lose themselves to addiction. Please keep us updated and feel free to post to Bluelight anytime you need support. Feel free to message me should you encounter particularly rough times or need to vent. Best wishes!