Buddha mentioned the students to have inspections first because bad things will inevitably happen when getting the wrong guru

When Like Jigme practiced Guru Yoga, he visualized Longchenpa as the Buddha. There was no impure thought towards Guru. For the Dharma practitioners, specifically Vajrayana practitioners, the Guru is very important. Therefore, one takes time to learn about the Guru, the qualities of the Guru. And the conditions to be a Guru is very important so we should not accept a [person to be] Guru that is not qualified. Because we have to rely on the Guru for the rest of our life – not only in this life but many lives in the future.
People sometimes don’t understand these important things and very hurry in accepting someone to be “guru”. Then, since the “guru” maybe unqualified, then problems will arise later. That will definitely happen because the Guru is not qualified. So, it’s important for people to be patient, be smart, to be honest and to take some time to investigate – to study, to be familiarized with the Guru, and then accept, and be a good student. If you read different books on how to look for a Guru, then you’ll get a lot of information that’s very important. To accept a guru is very important but it could be dangerous. Therefore, the Buddha mentioned the students to study first. Otherwise, it could be dangerous because a bad Guru can lead one to lower realm or that will happen badly, very easily. So therefore, it is a dangerous. We should understand that and then try to be careful. The teachings are saying that accepting a wrong guru is taking a poison, very strong poison. When you take a poison then, you are finished. And when you accept a bad guru, then you’re also finished. So therefore, it’s dangerous.

Hungkar Dorje Rinpoche, GURU YOGA: Bless Me So That Delusion on The Path Will Cease”