Is this for extant data? If so, you've a couple of options:
1. Select cases to have identical values on the variable(s) of interest. For example, only females (for the gender). Doing so removes the threat of extraneous variation due to the nuisance / extraneous / noise / control variable(s) entering into the scores. However, doing so reduces your ability to generalize any results . For age, perhaps selecting cases to fall within a 5- or 10-year span would have a comparable effect (if you're talking about adults).
2. Use the variables as covariates (for linear models or anova models) or as block variables (if you're thinking of anova type designs). This allows you to isolate the explanatory power of these nuisance variables from what would otherwise go as unexplained and/or confounded variance. In regression models, you could force the nuisance variables in first, note the explanatory power (e.g., R^2), and then add your IVs of interest and note the change in explanatory power (e.g., what the IVs can explain, beyond what the nuisance variables can explain).
The best type of analysis isn't clear, since you haven't identified your research question(s), and the variables you do wish to investigate, beyond the two nuisance variables of age and gender. However, the methods for control in data already collected are pretty much the same.
If you haven't yet collected the data, then you should most assuredly stratify the target population by these nuisance variables, and randomly select in appropriate proportion all of the resultant combinations of the nuisance variables. To the extent that the nuisance variables relate in any systematic way to the DV(s), this will give you better precision with respect to any parameter estimates you might obtain.
Depending on what you mean by "adjusting", your design (are you comparing quasi-experimental groups or real experimental groups, or something else), and your research question(s), you might consider a matching procedure. You will need to provide more information to get more informative answers, but I recommend consulting (https://www.amazon.com/Design-Observational-Studies-Springer-Statistics/dp/3030464040).