Beyondstressed, welcome. I don't think you can avoid each step on the road in front of you. Since your granddaughter does have a father, he will have to be involved. If he isn't fit either, you will have to work through that in time.
I have learned a lot over the years about what I can and can't control. We can't control other people. We can't control the police, or the courts, or judges or any other people, places and things. We can only control ourselves and that is a full time job.
You can't fix your granddaughter's world to be like you would wish it could be for her. She was born to a drug addict, it sounds like, your daughter, and that is what it is.
Accepting what is---reality---and working from there will be helpful for you to start with.
You obviously care so much for your granddaughter, and I hope you will start taking the necessary legal steps to see what is possible to give her the best possible life. Remember, along the way, to take care of yourself, set boundaries with people like your daughter, and take one day and one step at a time. It is likely to be a long road.
Hugs to you today.