Is the tracked website by chance on a different domain as Matomo?
The normal opt-out iFrame loads from the Matomo domain and sets a cookie on the Matomo domain.
But that means that the cookie is a third-party-cookie and a lot of browsers block those by default therefore breaking the opt-out.
But you can use the Matomo JS API, to easily write an opt-out form that instead sets the cookie on the website domain. This means that they are only opt-out for this website and not all websites tracked by this Matomo instance, but it should work more reliable.