I was going to ask if this was the 2016-2017 non-touchbar MBPro since this model has a higher rate of SSD failures than other models. The SSD controller is starting to fail which tends to be noticed most often at power on, or when waking the computer from sleep (SSD is a bit slow to go ready).
You can check to see if the SSD may be covered by the Apple free SSD repair program listed here, but most likely the program has expired for your laptop:
13-inch MacBook Pro (non Touch Bar) Solid-State Drive Service Program - Apple Support
You should also check to see whether the laptop qualifies for the free Battery repair program (again, most likely it is expired):
13-inch MacBook Pro (non Touch Bar) Battery Replacement Program - Apple Support
Besides making sure to have a good backup now while the SSD is still somewhat functional, you will need to have the SSD replaced. You can have Apple or an Apple Authorized Service Provider examine the laptop to provide you with a repair estimate. They will only replace it with another SSD of the same size.
You can install a third party SSD from OWC which may be a bit cheaper for the same size SSD, but there are some possible limitations using a third party internal SSD. The biggest issue is that macOS 13.x Ventura is unlikely to install on this laptop if you install a third party SSD without first installing Ventura while the original SSD is already installed since the installer includes a required system firmware update which requires an original Apple SSD to be installed internally (at least this was the case with the macOS 12.x Monterey installer last year---haven't heard anything about Ventura yet). Once the system firmware has been updated, then the macOS installers will install just fine with a third party SSD installed internally. You may need to worry about the same issue next year if Apple allows this 2017 laptop to run the next major version of macOS.
Installing the third party SSD internally is a bit tricky as the Bottom Case is tricky to remove & reattach and disconnecting the battery is a bit more complicated since a screw must be removed along with disconnecting a cable which is very easy to damage as is the connector on the Logic Board. If the cable or connector are damaged, then it will require an expensive repair to replace the Battery or the Logic Board respectively. OWC provide video instructions on the product page, but they will make things look easier than they are. This third party SSD upgrade option may be best left to a repair tech (Apple won't do it, but an AASP might).
Another option would be to install macOS to an external USB3 SSD and boot from the external SSD. It makes the laptop a bit less portable as you have more stuff to carry around and connect each time, but it is an option that doesn't require a repair. Plus the external USB SSD can later be re-used when you decide the laptop should be retired. The internal SSD will only work with this exact model laptop so it cannot be removed and accessed externally as there are no adapters or enclosures for it.
Another consideration on whether it is economical to repair this laptop is to consider the health of the battery. Use third party app Coconut Battery to see the battery's condition, keeping in mind once the Full Charge Capacity (bottom bar) gets near 80% or less, that you may find the battery may not run as long plus the battery is more likely to fail as it ages. These Apple USB-C laptops from 2016-2019 have known design issues with the Keyboard as well as the built-in Display. Plus on the non-Touchbar model you want to make sure the USB-C ports are not too loose. If the USB-C cables feel really loose, then that can be a problem which may cause the charger or other devices to disconnect more easily if the cables are pulled or bumped. Unfortunately the USB-C ports have a design flaw which causes them to loosen up over time, but these USB-C ports are hardwired to the expensive Logic Board. Just some things to consider when getting this particular model laptop repaired.
Make sure to have a good backup while you can.
FYI, here is the current list of the publicly acknowledged free repair programs for various Apple products (some products like your laptop have multiple programs available -- even more than the two I have already listed):
Apple Service Programs - Apple Support
You should always have frequent and regular backups of your computer and all external media (including the cloud) which includes important & unique data.