Ouch!
It does sound like your internal SSD has failed. While I have seen some instructions for allowing the system firmware update to work from an external drive, it is risky and had limitations as it would only work with the system at a minimum firmware revision. The instructions were only for a Monterey installer, but may still work for older systems.
Unfortunately without a working internal drive, you won't be able to install macOS 10.13+ on this system.
However, you if you have access to another working Mac that is compatible with macOS 10.13 High Sierra or macOS 10.14 Mojave, then you can make a bootable macOS external drive for that other working Mac. Then you can use that bootable High Sierra or Mojave external drive on this 2013 iMac. The trick is to make sure you use the older MacOS Extended (Journaled) (aka HFS+) file system since this old iMac cannot boot from an APFS without a system firmware update. If the external USB3 drive is a Hard Drive, then it should not be a problem using the HFS+ file system. However, if the external drive is an SSD, then macOS will automatically convert the HFS+ file system to APFS during the install process. I know it used to be possible to modify the installer (or provide it with a special flag) to force it to keep using the HFS+ file system, but I don't know if that is still possible with the latest installers. I also don't recall the exact modification, but it should't be hard to find if you search online.
Another option would be to install Linux Mint on this 2013 iMac. Linux is a great way to extend the useful life of older computers, but it does require you to learn a new OS. Linux is not for everyone. You can try out Linux Mint without installing in order to get a feel for what Linux Mint is like. Just select the "Live" option when booting the Linux Mint USB installer. Performance will be very slow since it is running from a slow USB stick, but it will give you an idea what Linux Mint is like. Linux Mint will have great performance once installed onto an external drive. If you do install Linux Mint, just make sure you have a known good macOS USB installer so you can reinstall macOS easily. Unfortunately most of the common proprietary software is not available for Linux, although there are a lot of free open source alternatives such as LibreOffice. Many popular third party web browsers are also available for Linux (Vivaldi, Firefox, Google Chrome, Brave).
Unfortunately it is very difficult to have the internal Apple SSD replaced and probably even more difficult to find a working Apple OEM SSD that is guaranteed to be compatible with this iMac. I'm not aware of any way to use a third party M.2 SATA based SSD internally since all of the Sintech adapters I've seen are for NVMe based SSDs which is not an option for you without a system firmware update. And installing a 2.5" SSD internally is not an easy option either since the necessary SATA & power cables are not installed from the factory for an SSD only configuration. These cables normally attach to the back side of the Logic Board. So both options require removing almost all of the internal components which is very risky.