How do you find duplicate Google Analytics code?

Start with Tag Assistant because it shows the Google tags and containers detected on the published page. Record every GA4 measurement ID and GTM container ID, then compare them with the property you intend to use. Two tags are not automatically wrong, but two copies sending the same events are.
Search the rendered source for the measurement ID and googletagmanager.com. Check Site Kit, analytics plugins, cookie plugins, theme header settings, custom code managers, child-theme files, and GTM itself. A tag deployed inside GTM will not appear as the same inline snippet in the original page source.
Disable or remove one source at a time in staging or during a controlled change. Clear WordPress and CDN caches after each change, then reload through Tag Assistant. The final setup should have documented ownership, one base tag path, and only the deliberate event tags needed by the measurement plan.