Whilst routers can be used to perform switching functions and likewise some layer 3 aware switches can perform routing functions it is not really their intended purpose and best practice would dictate you shouldn’t do it.
If you were to look into this as a temporary measure for a small set of low bandwidth hosts then it would be acceptable but personally for anything else I would steer aware form it.
Another reason I say this is as well as it not adhering to best practices you won’t get the port density you require using a router as a switch and the throughput of older, sat in a box collecting dust, equipment is likely to be much lower than you think. Did you know a Cisco 2621XM for example will only push about 15Mbps?!