In space, a spacecraft does not just keep going forever after it's been blown up; depending on its altitude, it will take anywhere from five years to one month to deorbit due to parasitic drag, which slows it down and lowers its orbit until it reenters.
Anti-satellite tests on orbital things could lead to the Kessler Syndrome having a cascading effect of spacecrafts blowing up and affecting other spacecrafts which eventually leads to a debris cloud that could affect space assets for 50 years.
The kinetic energy released by satellite explosions in space is so strong that it can take thousands of years to deorbit the debris, which poses a great risk to other space missions orbiting Earth.
Deorbiting a spacecraft in low Earth orbit can take anywhere from two months to five years depending on its altitude, due to parasitic drag slowing down and lowering its orbit until it reenters. Even the smallest drag devices, such as a 40-foot ribbon, can speed up the reentry process by months or years.