AES ECB deterministic encryption to perform Private set intersection
Yes, there is a more secure way to achieve your goal. For uniqueness you can use SIV mode with a static nonce. SIV mode first calculates a MAC over the plaintext and then uses that as IV to the mode of operation. This means that identical plaintext will result in identical ciphertext, but that plaintext that only differ by a single bit will result unrelated ciphertext. That way the leakage when identical blocks are used in the plaintext is avoided. SIV has the advantage that integrity / authenticity of the message is protected as well.

SIV has the disadvantage that it requires an authentication tag to be included, to achieve the aforementioned integrity / authenticity. This authentication tag then doubles as IV vector for the internal cipher (hence the name: synthetic IV). If you for some reason does not have the space to store the authentication tag then you may need to look at Form Preserving Encryption of FPE.