So, I actually work in casting...
There are honestly a couple ways to do this sort of thing and I'm going to take your example as a hypothetical because, let's be honest, you're probably not actually going to be casting Julia Roberts and/or Jonah Hill. No offense meant... just being realistic.
Split the Difference
You want someone to play both 30 and 50? Book an actor who's age is in the middle (35-40-ish) and use a small amount of makeup/hair changes to get them at either end. This is a great option for middle ages where people don't change a ton and when there's not a huge gap in age (10-20 years).
This effect can be done pretty easily and would likely work best in your specific case.
Need a wider gap or a larger varieties of gaps? Special Effects (SFX) Makeup is amazing. It's also becoming exceedingly common in the movie world.
Forest Gump used makeup extensively to age most of the cast to different stages of adulthood.
Hiring a talented SFX makeup artist is expensive but nothing compared to that $20 mil you're dropping on Julia or Jonah... each. This is most effectively used on large age changes -50 years or more.
The important note here is that the talent you hire has to be in the middle of this range. Preferably around 35-45 for it to work well. Too much older and it will be tough to age them down. Tom Hanks was about 38 when Forest Gump was shot and Sally Fields was about 48 at the time but a lot of her aging was making her much older while Hanks was going both ways.
Digital visual effects (VFX) is a third option. You hire a VFX team and they will digitally age your actor to the age you want.
Here's an example from Captain America: The Winter Soldier.
Personally, I'm not a fan of this option. It's viable but can end up looking really obvious... and fake... and it probably works better if your talent isn't moving around much, as is the case with the bed-bound Agent Carter from the example.
Using a combination of SFX makeup and VFX can be a strong option, like with Benjamin Button.
This option is really only viable in a few cases:
non-famous talent of adult/middle age (30-50). People know exactly what makes Julia Roberts unique. Any deviation can be jarring and can confuse viewers. Makeup is your better option.
Any talent who are already over 60 or so that a much younger (20-30 year-old) version will be assumed to be dissimilar enough that no one will care... plus, it's pretty much impossible to take an older person that far back. Think Men in Black 3 where Tommy Lee Jones' 40-years-younger Agent K is played by Josh Brolin. Jones was about 65 at the time of filming.
Intentional misdirect. They used two different actors for the characters in Gattica to obfuscate their relation to each other.
- Chad Christ/Ethan Hawke
- William Lee Scott/Loren Dean
Kids. If the version is under 18 or so, you pretty much have to get a second actor. They cast teenaged versions of famous actors in Now and Then.
- Gabby Hoffmann/Demi Moore
- Christina Ricci/Rosie O'Donnell
- Ashleigh Aston Moore/Rita Wilson
- Thora Birch/Melanie Griffith
Predestination - All kinds of crazy goin' on here.
There are probably some that I've missed in here but this is a good start.