How much can I afford to spend on a car?

I am searching for my first car. I have 5k saved (total) and my credit score is 702. I make around 4k gross a month, sometimes more, sometimes a little less. I have been spending about $800 a month on rideshare back and forth to work for way longer than I’d like to admit. I’d like to get a car relatively soon. I’ve been told to buy a beater but am interested in a new car because my main concern is reliability/warranty. New Hondas and Toyotas start around 22k and I’m hoping to put no more than $3500 down initially. It looks like my payments would be about $300 a month, not to mention insurance and gas. One advantage I have is that my rent is $600 so once I stop using rideshare I believe I can make larger payments on the car. With my income and expenses, what is reasonable?