Keep in mind that your new mortgage will have new 30y term – you will pay additional $25K in 2042 if you go full term. Also, the credit usually cannot exceed the closing cost and it can’t be applied to the principal balance. It will cover the lender’s and 3rd party fees (which you would not have to pay for without refinance, so that is no real benefit for you). You can use it to cover the interest due at closing and to fund the escrow account if you decide to pay your property taxes and insurance through an impound account.
Or you could refinance into 4% at no cost and save $100/month.