You cannot cancel a pending purchase or request a refund on a pending purchase.
As seen in the message on the screen when a free trial/subscription is started, you should cancel at least a day before (24 hours) before the renewal to avoid that charge. You agree to those terms by double clicking the side button, followed by authentication with Face ID or Passcode. If you cancelled within those 24 hours before renewal, it would be likely you are charged just like it says in the message you had agreed to.
While you owe money from a previous purchase, you will not be able to use the App Store for any reason, including downloading free apps or updates to existing apps. You can continue to use the phone in any other way, including the apps that you have installed on the phone.