Dark Companion by Andre Norton
In a future where humanity has scattered across the stars and Earth itself is a dimly remembered legend, two worlds of near-supernatural strangeness challenge two courageous young heros. Vere Collis and his friends were trapped underground when their planet was attacked, emerging to find hostile mutants had taken over the surface. Kilda was entrusted with the education of two children with an imaginary friend - which turned out to be neither imaginary nor a friend, and when it led the children through a rift in space time into a dangerous other world, Kilda had to follow, knowing that she was their only hope. Two complete novels of very different heroes fighting to protect the helpless in worlds that are wondrous, terrifying, and utterly alien.