How to detect duplicate values of sensitive data that needs to be encrypted
First, it is important to note that one important property of encryption is that you cannot determine if the same ciphertext is encrypted twice. However, assuming that you wish to give up on this property but you want it to be completely secure otherwise, then you still have to be careful.

Using regular encryption with the same IV is problematic. If you are using CTR mode then this completely breaks the encryption. If you are using CBC mode then if the first block is the same but the second is different, then you will be able to detect this.

The best solution is to use the AES-SIV or AES-GCM-SIV modes of operation with a fixed IV/nonce. These modes have the property that when encrypting different messages with the same IV, then you cannot learn anything apart from the fact that the plaintexts are different. Of course, if you encrypt the same message with the same IV then you get the same result.