I retired in August 2024 and have excess ($3100) contributions to my HSA. I elected to have the administrator return the excess to me. How does this affect my 2024 taxes?

I had a HDHP until retirement, but did not know the max contribution needed to prorated; hence the excess. TurboTax told me I have the excess. The $ was returned to me and I told TurboTax what I was doing. In addition to the effect on 2024 taxes, what will that do with 2025 taxes? Am I able to invest the excess contribution or deposit in a savings account?