Nowadays websites are not simply about design or UX but also about performance. Devices and chips are built to deliver battery all day long so everything is trimmed to efficiency.
As you can imagine, loading big files of unused Javascript is not something that comes in handy when trying to create a more efficient internet.
There are still areas without proper LTE (4G) in place but these visitors shouldn't be missed! Reduce your site weight to improve your loading speed by removing unused javascript & css
Google wants to provide the best experience to its users, and therefore ranks pages that perform well higher. It's called Core Web Vitals and the better your score, the better you'll do.
Keeping your code clean makes your website less prone for bugs and errors as well as reducing possible security holes. Only host what you need.