At the crossing are boards indicating that this is a railway crossing, two sets of lights for each direction of traffic (two amber, one red in each set) and barriers, typically long motorised boom arms from which a flimsier but more visible structure hangs, plus a tall post with CCTV cameras mounted on it. The CCTV feed goes with all the other signal data to either a "signal box" not so far away, or a larger centre where many signallers work together. A signaller who wishes to move a train through the crossing views the CCTV feed, and initiates a sequence in which the lights show alternating amber ("caution, stop if possible"), then red ("stop"), the barriers close road lanes entering the crossing, then barriers close the road lanes which exit the crossing. The signaller verifies everything is as intended (e.g. no vehicle stranded on the crossing, no idiot pedestrians clambering over the barrier and standing on the railway) and then authorises trains to pass. Once as many trains as necessary have passed, the signaller closes the crossing to trains, and tells the crossing to re-open to road traffic, it raises the barriers and then switches off the red "stop" lights and road users can now use it as normal.
I'd take Amtrak to my hometown, and the engine would blow past the platform at 20+mph and still stop the passenger cars right on the platform. Riding on the train and it seemed like they'd miss it.
I think the weight of a car itself wouldn't change the theoretically possible stopping distance, since the momentum is proportional to the mass, but so is the friction between wheel and track, so mass cancels out.