Vulnerable people have been left living in homes which have been deemed unsafe, the BBC has discovered.