Car stopping distances from 60mph/100kph are ~100 metres. 39,888 people died in the US in 2018 from car crashes. [1]
Emergency braking distance of a TGV from 300 kmph (186 mph) is something like 3,500 m [2], carrying ~450 people.
Moving block signalling systems take into account the current positions and velocities of both trains, and generate a maximum speed and braking curve. See [3] for the details, it's pretty fascinating systems design!
[1]: https://en.wikipedia.org/wiki/List_of_countries_by_traffic-r...
[2]: https://railroads.dot.gov/sites/fra.dot.gov/files/fra_net/16...
[3]: https://en.wikipedia.org/wiki/European_Train_Control_System