It worries me you have a pretty strong tolerance to Xanax.
You are right. You need a plan. An appointment with someone at the CPS office could be number one on the plan.
If you do take your granddaughter, if the mother is declared unfit or unsafe, you'll need to take responsibility for your own verbal outbursts and self-medicating. The little girl needs a healthy grandma. You love her, so take good care of you so you can take good care of her.
I hope things change for the highest good of the child.