This question is more on the theory of bitcoin. Let's say I receive a coin in a tx which has been confirmed with 6 blocks following the block that's been confirmed. How can I be sure that there's no other place in cyberspace that has a longer chain confirming a different transaction that transfers this coin to somebody else?
Building a chain longer than the best chain would require someone to have more Proof of Work hashpower than 51% or more of the total Bitcoin network hashpower.
The unlikelihood of this happening is the guarantee that the longest chain is the best chain.
To build a one block longer chain you'd have to assemble a block and find a nonce that produces a target less than or equal to the network target. Otherwise Bitcoin Core will discard your block as invalid. So to build a chain that is just 1 block longer than the current best chain you'd need massive amounts of hashpower, electricity, infrastructure and tens of millions of U$ investment. Again, all this for just one block.
The astronomic amount of work put into mining each block protects Bitcoin's consensus mechanism and assures everyone that the longest chain is correct.
If your TX was included in a block with depth 6 it means that for approximately one hour (~ 6 x 10 minute blocks) that chain where the block that holds your TX was included had the most work put into it all over the world.
There could be some other place where someone created an artificial chain with your TX in it but that chain will never be able to be longer than the main chain - unless they beat the network to find the next block. If they're unable to, then that chain will get ignored by everyone else in the network. That's how you know the TX you see on block explorers is in the longest/best chain.
For a more detailed reply you should read Antonopoulos' book (Mastering Bitcoin).
You can't be sure that there is not a longer chain somewhere else, since someone could work on another chain without telling anyone about it. It just becomes increasingly unlikely the more confirmations your transaction has.