Filtering duplicates from iCloud Photos Library while migrating from google photos
I use PowerPhotos for this and am super happy. Dump everything into one library, clone it and then try out various passes until you’re happy, then do the culling on your main library is my advice.

https://fatcatsoftware.com/powerphotos/

It lets me make rules once the pre-built ones take a first pass at cleaning the easy and obvious duplicates. You can prefer HEIC and edited or any other sort of metadata for automating which of the duplicates to select to keep and which to trash. It is updated very often, super easy to use and extremely powerful. I’m a decent “shell scripter” but in the end, this tool saved me many days of trying to “yolo” it with scripts. It’s got the goods on parsing photo metadata and wrangling libraries into shape in a safe manner.
Unless you’re willing to eschew Photos and syncing entirely, there aren’t better options. If you could exist entirely on filesystem and folders and a tool like Photo Mechanic to store photo metadata in the filesystem, I would go all in on Photos and iCloud and hire a tool if you can’t script it yourself.