Imagine a large office building where many people send and receive letters and packages every day. Inside this building, there is a mailroom and a post office. The mailroom sorts mail within the building, making sure letters get to the right office quickly. The post office handles mail going outside the building, deciding the best route to send packages to other buildings or cities.
In this analogy, the switch is like the mailroom. It connects offices inside the building and directs mail only to the correct office, not to everyone. The router is like the post office. It decides how to send mail outside the building, choosing the best path to reach other buildings or cities.