Although not all ad exchanges are safe, there are ways to ensure you are working with a trustworthy partner, such as compliance with IAB standards, transparent policies, or the presence of anti-fraud systems.
You can benefit from additional layers of security by using preferred-deal exchanges or private marketplaces (PMPs), as their more exclusive nature significantly reduces the chances of dealing with a bad actor.