A switch is designed to work on a single network. A router can transfer data from one network to another. This is why many home internet connections use a central router: its main function is to transfer data between the local network and the internet service provider’s external network.
The delineating line between these two types of devices is blurred because many routers and “smart” switches can perform multiple duties. A router can often work as a switch, for example. But in general, switches are simple devices for extending the number of ports on a single network, and routers transfer data across multiple networks.