The Torah says וְאָהַבְתָּ לְרֵעֲךָ כָּמוֹךָ, Love your fellow as yourself.
Kitzur Shulchan Aruch: It is incumbent upon every Jew to love every fellow Jew as he loves himself.
Rambam: It is mandatory upon every man to love each and every one of Israel even as he loves his own self.
However, the Sefer Mitzvot Gadol says ודווקא לרעך שהוא רעך בתורה ובמצות אבל אדם רשע ואינו מקבל תוכחה מצוה לשנאותו, specifically your fellow (Jew) that he is your fellow in Torah and mitzvos. But if he is wicked and doesn’t accept rebuke it is a mitzvah to hate him.
In addition, we also find the verse בְּצֶדֶק תִּשְׁפֹּט עֲמִיתֶךָ, judge your kinsman fairly, to which the Gemara derives עם שאתך בתורה ובמצות, With regard to one who is with you [im she’itekha] in observance of Torah and in fulfillment of mitzvot.
In halacha, which positive or negative commandments in the Torah would disqualify someone from being in the category of רעך בתורה ובמצות?
The Chofetz Chaim (Hilchos Lashon Hora) 4-7 writes that if the person has done aveiros numerous times, not because his yetzer hora got the best of him, but in spite, and he doesn’t care about doing aveiros. Or if he has done areivos that everyone knows is forbidden, i.e. basic kashrus, arayos, etc. then he is no longer considered oseh ma’aseh amecha, and the various mitzvos that are special to the way we are commanded to treat our fellow brothers will not apply. The same would apply to an apikorus, or a person that is mechallel Shabbos b’farhesia. It is important though to know that a person that was brought up not religious, and therefore acts this way, in most cases would be considered a tinok shenishba, and we can’t necessarily call him a rasha.