You can use Contact Key Verification to receive automatic alerts that help verify you're communicating only with the people you intend.
Start by opening the Settings app on your iPhone.
Tap on your Apple ID, which is represented by your name and picture, located near the top of the screen.
Scroll down and find 'Contact Key Verification' near the bottom of the menu.
Tap on 'Verification in iMessage' and toggle the switch to enable Contact Key Verification.
Congratulations! You've successfully enabled Contact Key Verification in iMessage