How to detect reorganization from bitcoind via ZMQ?
You can use the rawblock interface in order to determine whether there was a reorg.

Every time you receive a new block, you decode the block, in particular the block header. Then you store in your database each block and its previous block.

When you receive a block which shares the same previous block as another block that you have already received, then you know that a reorg has/is occurring.