This is one of the types of question that pops up from time to time that has no satisfactory answer, because the subject is completely polarized.
The official position is that there never would be a situation when a passenger should go onto the track per se, because there are a whole variety of hazards that would be present. It is also illegal.
That said, like all things in life nothing is ever black and white. Going onto the track in a suburban area would almost certainly be fraught with dangers, whilst doing the same on a little used branch line would certainly be less so. UNLESS of course the location on the branch line was on a curve with restricted viewing and trains travelling at say 90 mph, as opposed to a suburban station where there are no Conductor rails and plenty of sighting with a 45 mph speed limit.
Straight away it will be seen that there can be many variables, even the presence of busy roads, motorways, noisy factories, airports or airfields will have an impact on whether it is safe to be there or not.
Venturing onto the track in order to render assistance to someone in danger is an emotive subject, however best counsel is to contact the staff at a manned station as a matter of urgency.
In the event that a train can be seen approaching in the far distance or there are no staff then it could be argued that it would be a reasonable action to do something to assist. In doing so however one should always be aware that conditions on the Railway can change in a matter fo moments, and going down into the track between facing platforms can be likened to playing Russian Roullette.
If you are caught in the platform area then there really is NO way out, especially as it is far more difficult to climb back onto a platform than most people would assume to be the case, and many fatalities have occurred because of that.
From a lifetime of experience, which includes dealing with fatalities to people who were walking or crossing the track without any intention of causing themselves harm, I would counsel that only in the most dire of circumstances would it ever be advisable to go onto the track.
The better option is to call 999 and ask the Police to contact Network Rail or other infrastructure owner to have the trains stopped. This should certainly be the very FIRST course of action before entering forward into any heroics, many people have died through want of thinking things through when having gone to rescue a person who has ultimately survived whilst the rescuer has not.
In the case of a fire on a train, then the first course of action is to ALWAYS move away from the fire to other vehicles , the very, very LAST thing to do should be to force the doors open and exit onto the track.
In the case of belongings dropped onto the track at an unmanned station, it is better to wait for the train to arive and report the matter to the Guard or Driver.