Hello Achala Dias,
Thanks for your question.
The typical approach to resolve this is by recreating the resource. If possible, recreate the resource that was previously in the subnet and reattach it. This will restore the resource to its original state. From there, you can disconnect the resource and then proceed to delete the subnet.
See similar: https://learn.microsoft.com/en-us/troubleshoot/azure/azure-container-instances/connectivity/cannot-delete-vnet-subnet
You can mark it 'Accept Answer' and 'Upvote' if this helped you
Regards,
Abiola