Starting iOS 16 and also available on Mac is the Duplicates feature in Photos. The Photos app will automatically find duplicate photos and offer to merge them to save up space and reduce clutter in your photo library. To expand on this functionality, you should try CleanMyPhone.