Almost all naturally spawning mobs will automatically despawn when they're 44 blocks or further away from the nearest players in a world with simulation distance 4. On higher simulation distances, mobs are despawned when they're in a chunk at the edge of the simulation distance up to a distance or 128 blocks from the nearest player
From the 1.16.0 changelog: