Consider that miner A and B both try to solve its block, A's block has transactions (T1,T2), B's block has transactions (T1,T3). A solved its block then synced the block to B. Does B will discard its block which contains T1 and continuely create a next block contains T3? and how to check T1 is confirmed but T3 not?
Once A solves the block containing T1 and the new block reaches B, B will cease to mine for (T1,T3). When B receives A's block, it will be validated. As part of this validation process, B will check each transaction in the block, and notice that T1 has been mined in that block.
B will then construct a new mining template, including T3, and possibly other transactions that were recently broadcasted, or previously didn't make the cut due to space constraints. Mining will then commence on this new template for B.