Your SSD is most likely failing. The SSD's in the 2016-2017 non-Touchbar model tends to have issues and higher rates of failure. Have Apple or an Apple Authorized Service Provider examine the laptop to provide you with a repair estimate. Apple has a free SSD repair program for the SSD for some of the 2017 non-Touchbar models, but I have seen SSDs fail on the 2017 model which were not covered by the free SSD repair program.
13-inch MacBook Pro (non Touch Bar) Solid-State Drive Service Program - Apple Support
Also, this model has a free battery repair program as well (only Apple or an AASP can confirm if your laptop qualifies):
13-inch MacBook Pro (non Touch Bar) Battery Replacement Program - Apple Support
If the SSD is failing and it is not covered by the Apple free SSD repair program, then you can install a third party OWC SSD into this laptop instead of paying for Apple's overpriced SSD with known issues.
https://eshop.macsales.com/shop/ssd/owc/macbook-pro-13-inch-non-touch-bar/2016-2017
FYI, here is the current list of the publicly acknowledged free repair programs for various Apple products (some products such as your laptop may have multiple programs):
Apple Service Programs - Apple Support
If the Mac boots, you can check to see if there are any Kernel Panic logs located in "/Library/Logs/DiagnosticReports" which reference "nvme" at the beginning of the panic log. The Kernel Panic log files have names beginning with "kernel" and ending in ".panic". If a Kernel Panic has this reference near the beginning of the log file, then it confirms you have an SSD failure. The other way of confirming an SSD failure is by booting to external media (external macOS boot drive is best, but Internet Recovery Mode, or a bootable macOS USB installer can work as well) to see if the physical SSD is seen in Disk Utility. However, within Disk Utility you will need to click "View" and select "Show All Devices" so that the physical drives appear on the left pane of Disk Utility. If there is no physical drive listed under "Internal", then the SSD is most likely bad. Keep in mind that sometimes an SSD failure may be intermittent at first so even a failing SSD may show up in Disk Utility until the failure becomes permanent. As you have discovered an SSD failure can sometimes be triggered by sleeping & waking the laptop, or powering on the laptop.
Make sure to back up your data if you haven't done so yet, as it is only a matter of time before the SSD fails and you lose the data on it.
You should always have frequent and regular backups for the computer and all external media (including the cloud) which contains important & unique data.