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.
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.