It is smarter to rent a house if you are asking this question. Most likely a townhouse. I have lived in every type of home and yes also in apartments. Apartments are not at the same quality level as many townhomes and some of the benefits of apartment living can be duplicated with townhomes or smaller affordable homes.
Apartments are noisier and the parking is worse. Not to mention some people are uncomfortable with the route between their car and the front door to their apartment. Most townhomes will have atleast a one car garage.
I lived for a few years in an apartment but had fantastic neighbors and nobody living over me. I found it tolerable. No, they are not building townhomes better than a few years ago. Thank you so much for asking, is it smarter to rent a house or an apartment.