A switch is used to connect multiple computers via a LAN cable with each other so they are able to communicate with each other.
These computers need to be in the “same network” to be able to communicate with each other.
“Computer 1”: 192.168.0.1/24
“Computer 2”: 192.168.0.2/24
A switch can’t control or change the network flow like a router.
Theoretically you can compare a switch with a power distributor.