There are some ways to test and see if there is any apps causing the sensor to stop working.
-Go to Samsung members apps
-Select Diagnostics
-Test Hardware
-Select Fingerprints
-Test it (While you are facing the issue)
If the issue precedes then you have to visit the nearest customer service...