Offhand I'm taking a guess that it sounds like something is going on with the WiFi antenna inside your S8. If the phone isn't able to detect local WiFi networks like it used to able to, there's a chance that a few months ago the connector between the antenna and the logic board just disconnected itself in some way. Could have happened purely incidentally, do you recall bumping your phone or just dropping it on a table around the time this issue started to become evident? But currently it sounds like your S8 can only detect a WiFi network that's in close enough proximity that the signal is strong enough that without the antenna other, lessor WiFi signals can be detected.
And to fix this, it's not a trivial task. The ifixit site has a number of repair guides for a S8 if you want to do this yourself. If you go here to Step 21, there are two antennas and one of them could be the source of the problem:
If so, just re-seating both connectors might be the fix, but again this isn't a trivial project. Samsung loves to use a lot of glues and adhesives so tearing down your S8 requires the proper tools and equipment to disassemble and reassemble, plus there are the waterproofing seals that have to be replaced.
But the above is something that's more or less drastic. It could very well not
be a hardware issue at all but just software. Try going into the Settings menu, and do a Network Settings Reset. This is similar to a Factory Reset but it's limited only to network related issues so it will wipe the settings for WiFi, cellular, and Bluetooth and return them back to their original defaults. Things like saved WiFi networks and saved Bluetooth pairings will be deleted so it's not to be done just on a whim.