Any purchases made on in the iTunes, App, and Book Stores on an Apple device should automatically use your Apple ID balance. Do note that it may still ask you to verify your payment method on your Apple ID if there's an issue with it before attempting to use the Apple ID balance however. Link-> Change, add, or remove Apple ID payment methods - Apple Support
Purchases made in physical stores or online websites using Apple Pay will not use that balance.
You cannot get cash from your iTunes gift card balance on your Apple ID. You can only use it to purchaser things from then iTunes, App and Book Stores on Apple devices or pay for subscriptions.
You can transfer Apple Cash balance, which is a completely separate thing your Apple ID gift card balance, to your bank account if that is what you are referring to: link-> Transfer money in Apple Cash to your bank account or debit card - Apple Support