The Mars 2020 rover, or Perseverance, has been on the surface of Mars for over two years, and NASA wants it to last another decade.
Perseverance is step one of a complex process called the Mars Sample Return Mission (MSRM). The idea is to collect soil and rock samples from Mars and take them back to Earth by 2033. Originally, step two would have included sending another rover to get samples that Perseverance had dropped. But because of the expensive idea of building another million-dollar rover to collect samples, NASA canceled that idea and instead decided that Perseverance should keep the samples.
Instead, NASA will land a robot on Mars with a mini launch system built in and Perseverance will take the samples to the lander. However, Mars is a very unforgiving place for machines and the rover might not be able to survive the next 8 years on Mars. So, just in case Perseverance does fail on Mars in the next few years and is not able to take the samples to the lander itself, NASA ordered the rover to drop some samples on the ground. The idea is that if the rover dies in the next few years, some samples will still be accessible and NASA can use mini-drones to pick them up.
But for now, it seems that Perseverance can work just fine on the surface.