Would formatting my iMac fix my failing drive?
The 2013 iMac was offered with 1TB hard drive, Fusion drive, or SSD. The first two of these use mechanical spinning platter hard drives, which are expected to have a limited life before failing.

After six years, it's likely that the drive is failing, and so Erasing or repartitioning it won't help. Replacing the drive is possible, but "moderately difficult".