I had the same problem last year. Even started to write my own ‘bulk deduper’ script, but final result was far from my expectations. And then i’ve found a way to do almost the same without scripting.
I would advice to use no-code approach, described here, but don’t remove temporary table and fields.
it works according to Airtable behaviour for ‘copy-pasting something into link field’ - it searches matched value (ignoring ‘Limit selection by a view’ setting, but that’s another story) and then if it not exist, creates new record with that value.
After you create count field in temporary table and pass it via lookup in first table, you can filter ‘duplicates only’ (count>1) and divide them them into 2 groups according to your pattern. Since every ‘duplicate set’ represented by single record in temporary table, you can create other lookups (or rollups with ARRAYUNIQUE) in it (temporary table) and clearly see - which field values are match and which are ‘conflicting’.