Blockchain transaction verification

Blockchain transaction verification

I watched the 3Blue1Brown video about the blockchain and a question arose.

How is it ever guaranteed that if I send out a broadcast it will ever be put in a block that gets verified. For example it (my transaction) could reach miners who start verifying the block with my transaction but other blocks without my transaction get verified first therefore my block becomes obsolete because the everyone else is on another fork.

It seems like catching a moving train but with the chance that you run at the exact same speed as the train and never can get on it.