Imaam Ibnul Qayyim (rahimahullaah) said: When you confuse one of these groups with the other, you will find yourself in evil.
The first of them:
They are those with whom your intermingling with them is like nourishment that one cannot do without in the morning and evening. One abandons it after fulfilling his need from it, and then returns to it when he is in need of it (again). This is how it is on a permanent basis (with such nourishment), and this similitude is more precious than red brimstone.
The ones (intended in this similitude) are those who know Allaah, His commandments, the plots of His enemies, the diseases of the hearts and their remedies. They are sincere to Allaah, His Messenger and His creation. In this similitude (regarding) intermingling with them, there is an all-embracing benefit.
The second category:
They are those ones you intermingle with similar to medication that is needed during illness. So, as long as you are healthy, you are not in need of intermingling with them. They are those you cannot do without in (seeking after) the beneficial things of livelihood and fulfilment of various dealings, partnerships, consultation, medication and the likes. When your needs are accomplished through intermingling with them, then there remains from this similitude those ones you intermingle with in the third category (of people).
The Third Category:
They are those ones whom intermingling with them are similar to diseases in their various classes and types and the differences in their severity and mildness.
Amongst them is the one whom your intermingling with him is similar to chronic illness. It is that one you can neither benefit in the religious nor the worldly affairs, alongside the fact that you will either incur a loss in both your religious and worldly affairs or in one of them. So if intermingling with him is made possible, then it is that disease that is feared will lead to death.
And amongst them is the one whom your intermingling with him is similar to a tooth ache whose pain becomes severe upon you, but when it leaves you the pain abates.
The Forth category:
It is the one with whom your intermingling with them is absolute destruction, and intermingling with them is similar to eating poison. How common is this similitude within the people! May Allaah not make them numerous, and they are Ahlul Bidah Wad Dalaalah (The people of innovation and misguidance). They are those who hinder (people) from the path of the Messenger (sallal-laahu-alayhi-wasallam) and call to that which is in opposition to it. They are those who hinder (people) from the path of Allaah and seek to make it cooked; so they present innovation as Sunnah and Sunnah as innovation, and they present virtue as evil and evil as virtue.
And when you established Tawheed amongst them, they say: You have degraded the friends of Allaah and the righteous people. And when you establish the (affair) of following the Messenger (sallal-laahu-alayhi-wasallam), they say: You have invalidated (the affair) of the followed Imaams. And when you command that which Allaah and His Messenger commanded, and forbid that which Allaah and His Messenger have forbidden of evil, they say: You are from those who put people to trial.