When this happens, the blockchain branches. Then, the next block is added to one of the branches or the other.
In Bitcoin, the longest chain is called the "main chain," and blocks on the main chain are the valid blocks. So, blocks not on the main chain are considered invalid and called "orphan" blocks.
What happens to transactions that are placed into orphan blocks?
There is no cause for concern. Even if they are placed onto orphan blocks, transactions made without malicious intent are entered into the main chain at the same time.
However, you need to be careful if you receive Bitcoin in such a case. If you do not confirm that the Bitcoin you received is on the main chain as well, you may find that it is invalid when you try to use it.
The reason that Bitcoin is not confirmed until it has six authentications is to assure that the transaction is on the main chain and to avoid cases like the one explained above.