You're going to be in the town of Narita for several hours. I agree with the suggestion to get some yen from the ATM. You can buy your train fare (I've always used a vending machine, which uses a Suica/Pasmo debit card, but I've never seen anyone use a credit card), have a meal or two, visit the temple, and do a little shopping.
What to do with your leftover yen depends on how much you have left. The exchange booth landside will change bills but not coins. You can save the yen for another trip (that's what I do, since I go at least every other year). You can sell or give them to someone else who is going to Japan.