Migrating from Universal Analytics to Google Analytics 4

I am in the process of migrating from universal analytics to google analytics 4. I am currently using cakephp 3.10 and my analytics.js code is setup as an element block named google.ctp. Inside that file a different analytics id (UA-XXXX) is set based on if debug mode is on or not to track data from subdomains. How should I include GA4 (gtag.js) without changing the current process as I want to keep the existing universal analytics setup until it is active.