Hey, if you're interested in this topic, you may wanna read on historical examples of countries where that happened!
In the Soviet Union, for example, housing was guaranteed by the state, and homelessness was abolished. Everyone had a right to at the very least a room in a dormitory. Housing was for the most part obtained through the work union. Jobs were guaranteed and there was no unemployment, and the union at work was in charge of finding a flat for the worker and their family. Monthly rent was around 3% of the average family income by the 1970s, so it was very affordable too. If you're interested, there's a book called "Human Rights in the Soviet Union" by Albert Szymanski which goes into detail in these things!
In Cuba, housing is also guaranteed. A friend of mine (I'm Spanish so my friend speaks Spanish too) went to visit the country, and he had a conversation with some university students. On the one hand, the university students couldn't believe that my friend's family had two cars, they thought he was rich when in fact that's rather common for a middle-income family in Spain. On the other hand, they couldn't believe that my friend, at 22 years old at the time, was still living with his parents while studying at university. In Cuba, if you get a position as a university student, you get assigned housing for free while you study.
So yeah, just some perspectives of countries that actually managed to solve the problem of housing for everyone as a right