That sounds like the LCROSS mission.
A curious mission:
When ULA decided to retire its small(ish) Delta II launcher, it moved pending NASA missions to the much larger Atlas V. An adapter called the ESPA ring was created to facilitate ride-along payloads taking advantage of the Atlas V’s larger capacity.
Now, normally, ESPA rings are used to attach multiple smallsats. But LCROSS used the entire ring as single vehicle, mounting different components (batteries, solar panels, avionics, sensor platform, and maneuvering propulsion) on the various ESPA ports.
The ESPA ring was attached between the upper Centaur stage and the primary payload (the long-planned Lunar Reconnaissance Orbiter).
But after inserting the LRO into a Lunar Transfer Orbit, LCROSS remained attached to the now-empty Centaur. After several loops around the Earth/Moon system, LCROSS used its thrusters to aim the Centaur booster at a promising-looking near-polar crater where water might be found.
Some time before impact, LCROSS detached from Centaur, and backed up to trail the booster from a near distance. When Centaur impacted the moon, it created an ejecta plume, which LCROSS observed and then flew through, analyzing it, until it, too, impacted the moon.
It was the first mission to actually prove that shadowed lunar craters contained substantial quantities of water ice. (Previously, a Japanese orbiter had spotted some evidence of ice via remote sensing, but that was still tentative, with no quantity estimates.)
The proof that there IS water ice on the moon — quite a bit of it, in fact — was largely responsible for the currrent revival of sustainable moon-base ambitions.
So it was a very important and extremely productive mission.
(The current impact won’t be as science-y, because it doesn’t include an LCROSS-equivalent sampling probe, and it will take place on the lunar darkside, out of view (unless we get lucky and LRO or some other orbiter is in position to see the impact – but that’s still uncertain.)
(This is, BTW, far from the first time that expended upper stages and other junked equipment from NASA missions has crashed into the moon. Now that crewed exploration is returning to the moon, it will likely happen more often.)