You may need to add a working card first. Under various scenarios Apple will insist you have at least one payment method other than personal balance present at all times. It may be holding onto that card because of that, even though it isn't working. Add one that works and then you can remove the one that isn't.
Here is how you update your payment method on an iPhone or iPad:
1. Open the Settings app.
2. Tap your name.
3. Tap Payment & Shipping (formerly Media & Purchases). You might be asked to sign in with your Apple ID.
4. Tap Add Payment Method, enter the new payment method, then tap Done.
5. Tap Edit.
6. Tap the red delete button next to the old payment method, then tap Delete.
For more information see this article about updating payment methods on various platforms (iPhone, Mac, etc.): If you need to change or update your Apple ID payment method - Apple Support
Also note:
1) ”If you change your address, the credit or debit card information that you use with your Apple ID might be automatically updated by your financial institution, and you don't need to take action.
2) “If there's an issue [such as you having a subscription or being a Family Sharing Organizer], add a new card first, then remove the old card."