Justifications will vary from place to place. You mention the US example in your question, and this answer presents the justification that the US founders gave for this part of the US Constitution.
Regarding the age-30 requirement for US Senators, Federalist 62 says:
The propriety of these distinctions is explained by the nature of the senatorial trust, which, requiring greater extent of information and stability of character, requires at the same time that the senator should have reached a period of life most likely to supply these advantages
This is discussed again in Federalist 64, along with the age-35 requirement for President:
By excluding men under thirty-five from the first office, and those under thirty from the second, it confines the electors to men of whom the people have had time to form a judgment, and with respect to whom they will not be liable to be deceived by those brilliant appearances of genius and patriotism, which, like transient meteors, sometimes mislead as well as dazzle.
Yes, by definition, this discriminates against younger people, but as these requirements are listed in the Constitution, that discrimination is constitutional discrimination.