Massachusetts' reliance on hotels and motels to shelter homeless people will be phased out in the next couple of years, Gov. Maura Healey said Friday.