We always got ours done between four and six months and had no issues.
Our vet now prefers to wait until 6 months for spays on dogs, not sure on cats. Gives them some time to mature before a major surgery. I'm not actually sure on dog neuter time as our boy broke his leg a month after we got...