@Sairam Ganji Thanks for reaching out. To disable the function please refer to the disable function document.
You can leverage the Azure REST API to programmatically stop your azure function and to know more about the Azure REST API, authentication etc. please refer to this document.
You can also use the below REST endpoint to enable/disable a particular function
content-type: application/json; charset=utf-8
Alternative you can also use this API to update app setting on your function app.
In case if you want to do it for your local environment then you can define below in your local.settings.json but when you deploy to azure then you need to define it in Application setting of your function app.
Feel free to get back to me if you need any assistance.
Please 'Accept as answer' so that it can help others in the community looking for help on similar topics.