I have a layover in Sao Paolo of 5-6 hours depending on how quickly I get out of the plane. Is it easy to explore the city? Or are there any nearby attractions? I am looking for something I can get to cheaply and without the risk of delayed transport back to the airport.
It depends a lot if you get your bags really quickly and depends a lot on the traffic conditions of the day. Sao Paulo has a massive car fleet for its population (10 million cars for roughly 14 million people) and the Guarulhos Airport is far from Downtown, without easy access to train/subway to the airport (it will take you 2 hours to get to the city if you take the combined bus and then the train).
If you are willing to risk it, get an Uber ride (some 40 USD) and then you can think of going to:
Avenida Paulista (Major Avenue, Financial Center, Interesting museum MASP towards its western end) Liberdade (Biggest Japanese colony outside Japan) Ibirapuera Park Main Downtown (Architecturally amazing, but it can be tough on tourists that cannot stand homeless people)
Be aware that those 5 hours won't let you visit more than one of these spots.
No, it is not easy.
I'm guessing you are connecting through Guarulhos, Sao Paulo's main international airport. At best, you should assume it will take you an hour to get from there to any destination within the city. If you arrive or leave at the wrong time, this could end up being two hours, each way.
Your best bet is to take a taxi or Uber, but public transport, including the bus transfers, don't have to be much slower and, given traffic conditions, might at times be more practical.
What to see depends very much on what has your interest. Sao Paulo is no Rio and has no must-see sights, though there is plenty that might be of interest; a bustling market hall, the city's main drag, a few very good museums, a nice city park, to name but a few.
However, you will be very much pressed for time. So much so, that it's not a very good idea to try your luck.
If, on the other hand, you connect through Congonhas, an airport that's only a bit south of the city centre, you would have some time on your hands. From Congonhas, pretty much irrespective of traffic conditions, you will be able to get to virtually anywhere in town within an hour, giving you several hours to spend in the location of your choice.