Check your active plugins, especially:
Jetpack (or Site Stats)
Any optimization plugin (e.g., Autoptimize, WP Rocket, LiteSpeed Cache, etc.)
Any custom performance or HTML minifier plugin
Temporarily disable optimization/minification and clear your cache.
Then reload your site and check the browser console/network tab:
If the malformed URLs disappear → the issue is from a minifier plugin.
If they remain → the issue is likely from Jetpack or theme code.
Check your theme footer (often in footer.php or similar):
Search for stats.wp.com or <script src="https://stats.wp.com
If you find a script tag with ' defer='defer in it, remove the extra ' after .js