mining theory – How wallets/ miners differentiate bitcoin and bitcoin cash (forks of cryptos)? (technical IT question)

The protocol administers it.

Usually, one coin’s blockchain will not be compatible with another’s: for example, Bitcoin supports Segwit transactions, and Bitcoin Cash does not; whereas Bitcoin Cash has a high block size limit and Bitcoin does not. The point at which the two diverged is the point at which Bitcoin started mining Segwit blocks (which Bitcoin Cash clients will not accept as valid blocks, because they contain Segwit transactions), and where Bitcoin Cash started mining large blocks (which Bitcoin clients will not accept as valid). However, if there was a transaction that was valid on both blockchains (as may have been the case around the time of the fork), then that transaction can indeed be “replayed” on both blockchains, with both accepting the transaction.