The mentally ill were taken of the streets and put in psychiatric wards and not allowed to leave.
Functioning people were given employment and housing. Full employment was a promise kept by the Soviet communist system for half a century. Of course the job you got and the housing you received were frequently very substandard by western standards. A Soviet apartment famously had multiple families living in the same apartment, during the most severe stages of housing shortages

