Is the cookie used for the site to function (or a component of it) or for tracking/ads. Only the latter needs consent.
However that's how the vast majority of sites implement the cookie consent regulation, and authorities (like ICO in UK) has decided to not do anything about it.
not up on cookies and Gdpr tbh, I deal with other types of data normally.