Hi
This problem normally comes when the files are changed in some way as they are transferred to the Mac. Often the result of using different methods of transferring the files (EG texting / direct connection / photostream / iCloud).
Different versions of IOS can also impact this EG when photos are converted from HEIC to JPG. Iphone setting photos>transfer to mac or pc - set to automatic might convert the files. Try setting this to "keep originals".
Another cause can be when iCloud photos is enabled on the phone with “Optimise phone storage” set. If iCloud re-downloads an image that has been optimised, that can result in it being seen as a new image. Even worse, any photo uploaded from your mac to iCloud, then downloaded to the phone with iCloud can be seen as a new image when synced via USB. Best solution; DON’T mix iCloud sync with USB sync.
Photostream is also being phased out, and hasn't been improved for some time resulting in an inability to work with some file types.
Images will only be recognised as the same image if the file being compared on your mac is exactly the same as the one on your phone. Same file name and type, same size, same metadata etc.
By far the easiest way to manage photos is by using iCloud sync, but that does have a monthly cost.
What version of MacOS do you have?
What version of IOS is on you phones?