99 cavalier won't start after running a while

1999 cavalier, 2.2, 200,000 miles. recently purchased this car for gas/commute purposes. I have 30 miles to drive to work. If I stop to get gas and try to restart the car, it won’t start unless I let it sit for 5-30 minutes. When it does start, it runs rough to begin with. Any ideas?