This is a game problem. It happens whenever you add, remove or change a track or road next to a vehicle. The vehicle will “teleport” to a different spot nearby. If you changed the track while in pause mode, the train will still teleport but it will still appear to be in the same position. When you click on it, it’s not really there so the game won’t recognise that you clicked on it.
You’ll need to turn off pause for a few seconds so that the graphics can update to where the train teleported to. You can click on it again after that happens.
If you want to avoid this, try to keep your vehicles at least one whole track or road segment away from the segment you are about to change. This also includes laying tram tracks on roads.
I hope this helps.