For romantic relationships, it is not necessarily the age as a numeric value, but where they are in their life - what 'stage' they are in. Yes, maturity plays a role in this, but it's not the only reason.
For example, look at a five year age difference. You have a 20 year old dating a 15 year old. The 15 year old is still in high school, maybe has the worry of what to do Friday night, what friend group they want to be a part of, worrying about getting his/her license. Never really worked, has no financial commitments, and is dependent on parents.
The 20 year old is in post-secondary, possibly moved out of their parents home, has worked and has an income. They may have their own loans (school, or even a car), possibly looking to find a partner - and just generally has a better sense of direction of where they are wanting to go in life. Their sense of direction may not be clear, but it is clearer than it is at the age of 15.
Now you look at a couple who are ages 33 and 28. Both are typically done post secondary, are ready to settle down, can both be financially independent, etc. Both hypothetical couples are 5 years apart, but the 28 and 33 year old doesn't sound as drastic.
For friendships, age doesn't really matter to me. I have friends that are 10 years older than me, mostly because of work. I have acquaintances that are significantly younger than me, but I wouldn't hang out with them on a regular basis. As for my romantic relationship, my fianc? is 1 year older than me.... well 1 year and 9 days older.