Apple does not name the dangerous apps, see: Using third-party apps to remove duplicate photos might damage your Photos for macOS library - Apple Support
You should be weary of any application, that has not been designed for Apple Photos, but is a general tool to remove duplicate files. These programs do not know how to handle photos in a library and do not understand albums and multiple versions. As an example, I have not tested CleanMyMac in a long time, but the last time I tested it, the duplicate detection and removal had linked the wrong edited versions to the thumbnails for all photos, where I had several differently edited versions. And many original image files have been completely missing.
You need to use a duplicate detector that is collecting potential duplicates in an album and then is using the Photos.app itself to remove the duplicates. The app that I tested and found to be safe are PowerPhotos and PhotoSweeper. Both are not free.
- PowerPhotos can find exactly duplicate images, based on the capture dates and the filenames. iIs very useful in several ways. You can use it as a secondary Bowser for your Photos Library. and can sort your photos according to the size or the filename. It has a nice list view with the metadata in columns, so you can compare them. It can merge Photos Libraries as well and helps to switch between libraries.
- Photo Sweeper can find duplicates based on the contents of a photo. It is looking at the picture, not just on the file attributes, so it can search for similar photos.