Here is a very interesting statistical analysis suggesting that in some breeds there are major advantages (less risk of cancer or joint issues) to leaving the dog intact or waiting to desex until the dog is more mature, while in other breeds it doesn't appear to make much of a difference in long-term health when and whether you spay/neuter. There are also differences in outcomes for males versus females in some breeds.
Check it out: Assisting Decision-Making on Age of Neutering for 35 Breeds of Dogs: Associated Joint Disorders, Cancers, and Urinary Incontinence
Generally speaking, unless there is a risk of pregnancy or an issue like an undescended testicle, it's best to wait until the dog's growth plates have closed to neuter a male, as retaining their full allotment of testosterone will help their physical development be more robust. So once they've reached their full height and are filling out, basically. That happens earlier in smaller dogs than in larger ones.
Check it out: Assisting Decision-Making on Age of Neutering for 35 Breeds of Dogs: Associated Joint Disorders, Cancers, and Urinary Incontinence
Generally speaking, unless there is a risk of pregnancy or an issue like an undescended testicle, it's best to wait until the dog's growth plates have closed to neuter a male, as retaining their full allotment of testosterone will help their physical development be more robust. So once they've reached their full height and are filling out, basically. That happens earlier in smaller dogs than in larger ones.