You can take out your contributions to a Roth IRA at anytime. I could contribute $5,500 today and then 1 year from today let's say it's worth $6,500. I could withdraw my $5,500 contribution penalty free.
The 5 year rule only applies to the earnings. You must have had the Roth IRA for 5 years to withdraw the earnings, even if you're over 59 1/2. There's no time limit on the contributions.