Not all cookies are harmful. Session cookies keep you logged into a website without requiring you to re-enter your password on every page load. First-party cookies store your preferences and are generally benign. Third-party cookies are placed by domains other than the one you are visiting — typically advertising networks — and track your behavior across many different websites.
Third-party cookies enable the advertising targeting that follows you around the internet. Visit a shoe website once, and ads for that brand appear on unrelated news sites. This works because the advertising network's cookie is present on both sites, linking your visits together into a profile.
Deleting cookies removes one layer of tracking but not all of it. Fingerprinting does not rely on cookies at all — it uses data your browser reveals with every request. You cannot delete your fingerprint, but you can reduce its uniqueness by using a privacy-focused browser or the Tor Browser, which standardizes these characteristics.
Cookie consent banners exist because of privacy regulations like GDPR. You are legally entitled to reject all non-essential cookies on sites serving EU residents. "Accept all" should never be your default — take an extra five seconds to select "Reject all" or "Necessary only."