As mentioned in the FAQ 'How do I make a block in my course visible to teachers but not students?', another method is to edit the permissions and remove Authenticated user, Guest, and Student as roles with the moodle/block:view permission. You would then need to ensure that all teachers are assigned the role of non-editing teacher on the front page.
The solution is not so easy because normally teachers are assigned the role of teacher at course level. Thus, for anything outside of the course, such as the front page or dashboard, to give users additional permissions, you need to assign them a role in the front page or a system role.