FWIW, sand drags are used to ensure that deliberately-derailed trains come to a rapid halt without too much damage. These "trap points" are used to ensure that a runaway train from a high-risk zone doesn't run down a steep hill (where it might derail in an uncontrolled manner) or into oncoming traffic.
There are also strict rules about running on flooded track, with maximum depths measured in mere inches. These have several reasons behind them - one of which is that flooded ballast is much weaker at holding the track in place than normal, and another has to do with the fact that traction motors, carrying large amounts of electric power, are usually very close to rail level. In steam days, the problem was usually related to the air intakes for the firebox, which would extinguish the fire pretty quickly if they ran through water. Occasionally, hydraulic-transmission locomotives might be able to pass track that is quite deeply flooded, but that is not common.
Another major danger with flooded track is that the source of the flooding might wash away bridges or embankments - this is also a danger for roads, of course. When that happens, a line closure for major repairs is inevitable. In a famous case, the GWR responded to such a event by building a temporary bridge alongside the site of the original in a week flat - including waiting for the floodwaters to recede. They then proceeded to rebuild the original bridge at a more leisurely pace. And this was in wartime, when there was a chronic shortage of manpower and materials.