It's not based on need, it's based on equality. It is not that straightforward for government to determine who needs what. Instead, people with more means should give more (taxed more). And, like you yourself said, targeted social programs, like housing, don't always work anyway.