Approaching the station, there's an announcement on the train "Everybody getting off at the next station please move to the last carriage". Then the last carriage simply detaches from the train and coasts into the station to unload at the platform.
Meanwhile, another carriage has been loaded with the passengers who were due to get on at the station. After the train passes the carriage is shunted by a small locomotive to catch up with the train and it attaches to the end.
No need for crazy long parallel tracks and dangerous transfers between high-speed trains. Difficulty: most high-speed trains have locomotives at both ends afaik, but that's a minor issue.