If you just pressed a subscription button, then it was not done by an in-app purchase that can be refunded by Apple. When using an in-app purchase for a subscription, you have to actually double click the side button with the amount showing on the screen followed by verification using TouchID/FaceID or passcode. This prevents accidental purchases.
If you subscribed on a web page that the app directed you to or provided payment info directly in the app, then you will need to cancel the subscription on that same page and also request a refund through that company. Subscribing on a web page or providing the app with your payment info directly bypasses Apple from being able to manage the subscription. There are many companies that have an app that also choose to manage subscriptions themselves to avoid Apple being able to cancel/refund them. Some examples of these are Netflix, Walmart, YouTube, and many more.