Stimulants increase activity in the frontal lobes. Underactivity in the frontal lobes is common in ADHD, while overactivity is common in anxiety. So increasing frontal lobe activity will usually lessen ADHD but can make anxiety worse.
Of course, some people are diagnosed with both ADHD and anxiety. There are a couple reasons for this. Firstly, anxiety can cause symptoms that are mistaken for ADHD in many cases - feeling jittery looks like hyperactivity, hypervigilance looks like distractibility and sometimes impulsivity, and chronic worry looks like inattentiveness.
Secondly, not all cases have the same mechanism. For example, although some kinds of anxiety (especially worry and rumination) are associated with overactive frontal lobes, other forms are associated with the amygdala threat detection system instead (panic attacks and phobias especially). So a person could have underactive frontal lobes and overactive amygdala, leading to both ADHD and an anxiety disorder.
Autism is also associated with frontal lobe issues, but they don't tend to respond to stimulants. It's unclear whether this is due to different pathways in the frontal lobes (the ones associated with impulse control and attentional focus vs organization and planning), or because autism may be affecting the frontal lobes indirectly through the cerebellum (which has tons of links to the frontal lobes, plays a central role in sensory processing and motor coordination, and seems important for social interaction).
The brain is really complicated.