You can indeed host an ASP.NET Core Web API within an Azure Function.
These articles help you to do it:
https://learn.microsoft.com/en-us/azure/app-service/app-service-web-tutorial-rest-api
And this is step by step guide
https://andrewhalil.com/2021/03/05/deploying-a-net-core-web-api-application-to-azure-app-services/
** Please don't forget to close up the thread here by upvoting and accept it as an answer if it is helpful **