I can't remember the name of this movie where they are transporting two prisoners. They are driving and turn on country music and pick up some people off the side of the road. The van rolls over and they get out and go into a cave with aliens in it. The two officers die in the cave, the rest of the people escape. In the movie, an alien invasion is happening in the city.
This could well be a very low budget sci-fi film from 1998 called Alien Species.
A humorous review is available here, which bears full witness to the film's cheesiness, but a more measured summary from IMDB describes the plot as:
A fleet of UFOs is circling the Earth and a top scientist races to discover their true intentions for the planet. When the UFOs begin an attack on Earth, the scientist finds himself thrown in with a sheriff and his deputies transporting some prisoners to jail. The unlikely group is forced to seek shelter from the attack in a nearby cave, not knowing how significant the location is to the alien's plans.
The sheriff and deputies are indeed escorting two prisoners, and they all take shelter in a cave. Unfortunately the cave is where the aliens are harvesting the humans they capture during the invasion, wrapping the bodies in cocoons. The rest of the film concludes essentially as described in the question.