How does Signal Messenger's Safety Number Works?
Here is a detailed blog post about the safety numbers:
https://signal.org/blog/safety-number-updates/

They are unique per conversation and basically consist of hashes of your and your contact's public long-term key.

You should compare them if you want to be sure that there is no man-in-the-middle.