I think what they hit was a small "moonlet"(Dimorphos) orbiting a larger asteroid(Didymos). I think they were just trying to affect the moonlet's orbit around the larger Didymos. It sounded like they were expecting the orbit of Didymos to be unchanged.
NASA’s Double Asteroid Redirection Test (DART) spacecraft recently got its first look at Didymos, the double-asteroid system that includes its target, Dimorphos.www.nasa.gov
This little rock (moonlet) is stuck in orbit around the bigger rock (asteroid).
By hitting it head-on... it's orbital speed will decrease and the the asteroid will draw it a little closer.
As long as the asteroid orbit is unchanged... There's zero danger of the little moonlet getting pushed into an orbit which will cross Earth's path.
The expected change in the moonlet's orbit could easily be estimated since they know the approximate mass and speed of the moonlet, spacecraft and asteroid.
The biggest challenge was getting a dead-center, head-on impact.