If that many people suddenly died you can be sure that many more will as well. Our society right now is dependent on numbers, we need skilled labourers preparing and distributing food, we need electricity and fuel for heat and transportation, we're basically useless alone. I don't think we have created long lasting food supplies as you say. At most some canned goods in store shelves can last maybe ten years. Starvation or cold will kill off the remaining few before long, in the case of a near-extinction event.
First of all, expiry dates on canned foods only mean that the manufacturer believes that the food will taste/smell/look acceptable if you open the can before the date stamped on it.
Canned foods that last long to begin with (like a year or more) will not become unsafe to eat as long as the can is not compromised. You could safely eat a can of tuna, pineapple or spam 100 years from now if you keep it from rusting. There is no real known limit to the safety exipiration on these things, we cannot measure them but know that the first properly produced canned foods are still safe to eat today. They might last 1000 years,
there is no reason to believe otherwise, but no proof that they do either.
There would also be a LOT of stuff. If 99.999 of people just randomly died right now, the population of my city would be reduced from 400.000 to 4. There is enough stored food in the city to last 4 people several lifetimes.
But you rightfully put forward that we do rely on infrastructure like electrical power, heat and running tap water to survive. Given my geographical location it would be wise to move south to a point where it doesn't freeze over in winter. This could mean driving from holland down to the southern end of europe, as in portugal or spain.
Can you drive there with fuel stations inoperative? Sure - there are now about 50.000 cars per person available, and you could just take the next one when running out of gas, or alternatively take a diesel tanker truck and drive that down on it's own contents.
Mars or the moon provide none of this, not even breathable air. No shielding from cosmic particles, little proven mineable resources, and probably no way back when in comes to mars settlement.
Building a base on the moon and constantly supplying that is certainly possible, but one big question would be 'why'. While the moon might actually have some usable substances to mine (like lithium for fusion power) there is no reason to send manned missions.
Saving humanity as a species is not a good reason either, as such colonies would not stand a chance without constant resupply. If most humans on earth died for some reason that supply will not be coming any longer.
Looking at alternatives like Europa would be interesting, though i'm not sure it could support earth-based life considering the distance from the sun and tiny mass (it's lighter than our own moon). I'm all for sending probes over to establish if life ever formed there and perhaps still is present beneath the surface.