Restart your device if your internet connection seems worse than usual.
Switch off other wireless services. Turn off mobile network if you are using Wifi connection. On the other hand, if you are using mobile network, turn off Wifi connection.
Use your device's pre-existing troubleshooter to troubleshoot potential problems with your device's network.
On Windows, click on the Windows search bar and search "Troubleshoot network". Open Find and fix network problems and follow the instructions given.
On macOS, choose Apple menu -> System Preferences and click Network. Click Assist me, and then click Diagnostics and follow the instructions given.
If your computer has a port for Ethernet cables or you have an Ethernet adaptor, consider using an Ethernet connection instead of Wifi as wired connections are more stable.
Restart your router by unplugging it, waiting 30 seconds before plugging it back in.
Check that your router is not overheated. You may want to switch it off at fixed periods of time to let it cool off, increase ventilation around the router, or replace it.
If it has been 4-5 years since you replaced your router, or
if your router gets very hot very quickly, or
if your internet speed is still slow even when there are no problems with the connection
Your router may be too old and you might want to look into replacing your router with a newer model. You should look for a model with at least the IEEE 802.11a/b/g/n/ac standard.
You may want to look into enhancing the coverage of your router. You can do so by adding a Wifi range extender or repeater.
For the best Wifi coverage throughout your home, you can replace your router with a mesh Wifi system such as Google Nest Wifi, LinkSys Velop and TP-Link Deco.