Can't format my SD Card in my Android
Got similar problem a few days ago after upgrading to LineageOS 17.1.
Best option to be sure if your card is corrupted or not : Put it in your PC (Windows, Mac or Linux, doesn't matter) and try to format it. If it fails from computer, consider SD card is corrupted.
If you do not have a computer or an SD card tray in your computer, try to root your phone and format the card using Aparted app (available from Play Store, but requires root)
Good luck with this