There's a 100x100 protected area centered around each. So around 50 blocks away depending on direction.
The next thing to take into account after where you can is where it would be safe, but I'm sure you already imagine that building right where the protected area ends is risky. Not only for people griefing it on purpose but also because creeper accidents. So the further the better.