One unescaped character can make an XML sitemap unreadable. URLs with several query parameters are a common trigger: the separator & must be written as & inside XML.
Read the XML before testing the URL
Fictional example: the browser should request https://example.com/list?colour=yellow&page=2. Inside the XML loc element, that becomes https://example.com/list?colour=yellow&page=2. An XML parser converts it back into the intended address.
Do not replace every special character with a percent sequence. XML escaping protects the document structure, while URL encoding represents parts of an address. They solve different problems.
Open the raw sitemap in an XML validator or your development environment’s XML parser. Record the first reported line and compare the original CMS value with the exported loc value. The export may be broken even when the stored address is correct.
A manually repaired file lasts only until the next export. Use an XML serializer to escape values, then check a URL containing an accented character and another containing multiple parameters. Avoid escaping values twice: & changes the address the parser reads. Finally, request that parsed URL and confirm that it leads to the intended page.
Related check: Remove redirects from a sitemap.
Once the fault in your frontend export is established, you can enquire about a scoped fix through Frontend optimisation.