I say it depends on what your needs are and also where you live. If you live in a fairly urban area and condos and townhouses are common, then those are good options. Some parts if the country living in townhouses and condos is rare, harder to sell when you want to sell, and appreciate very slowly even when the market is moving up.
Some townhouse associations take care of the roofs on all the houses, some don’t. Some take care of cutting the lawn, some don’t. You have to read over the documents and what the maintenance fees cover. Where my MIL lives they take care of cutting all the lawns and trimming the hedges and trees and she lives in a single family house.
If you live on less then 2 acres I recommend some sort of HOA or you could wind up living next to someone who rings down the value if your house with how they take care, or lack thereof, of their property.
I grew up in a townhouse most of my childhood and I never heard a neighbor through a wall. Codes probably vary from state to state on how the walls are built between units.
When I lived in a building I felt much less worry about my property when I left town for a week or two. If you travel a lot it can be a much easier lifestyle. Also, if you are in a big condo building there might be maintence men right on site to take care if maintence issues, which can be a nice convenience.