This document provides detailed steps on how to call Azure function in SPFX:Consume enterprise APIs secured with Azure AD in SharePoint Framework
You could refer to this document for troubleshooting, especially the enable CORS section.
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.