Vayikra19:18

לֹא־תִקֹּם וְלֹא־תִטֹּר אֶת־בְּנֵי עַמֶּךָ וְאָהַבְתָּ לְרֵעֲךָ כָּמוֹךָ אֲנִי יְהוָה׃

You shall not take vengeance and you shall not bear a grudge against the children of your people, and you shall love your neighbour as yourself. I am the Eternal.

Vayikra 19:18

לֹא־תִקֹּם וְלֹא־תִטֹּר אֶת־בְּנֵי

Vayikra / Leviticus 19:18 · Remez

Vayikra 19:18

לֹא־תִקֹּם וְלֹא־תִטֹּר אֶת־בְּנֵי עַמֶּךָ וְאָהַבְתָּ לְרֵעֲךָ כָּמוֹךָ אֲנִי יְהוָה׃

You shall not take vengeance and you shall not bear a grudge against the children of your people, and you shall love your neighbour as yourself. I am the Eternal.

Remez רֶמֶז

The letter "for your neighbour"

Loving another just as you love yourself seems impossible. Perhaps the Torah asks for something more precise?

Chizkuni: it does not say "love your neighbour" (רֵעֲךָ) but "love for your neighbour" (לְרֵעֲךָ), with the letter lamed (ל): love to do him good just as you love him to do good to you. Yismach Moshe: the words "I am the Eternal" answer the question of how a heart can be split between two loves. He is One, and from love of Him comes love of those who love Him.

How Chizkuni and Yismach Moshe explain it

Chizkuni And you shall love your neighbour as yourself

If you act this way, you will love him. And the letter lamed (ל) in the word "your neighbour" (לְרֵעֲךָ) is extra, as in "all the army (לְכֹל חֵיל) of Pharaoh" (Shemot / Exodus 14:28) and "all its vessels (לְכָל כֵּלָיו) you shall make of bronze" (Shemot / Exodus 27:3). Another explanation: it does not say "love your neighbour (רֵעֲךָ) as yourself", since that is impossible to do, but "for your neighbour" (לְרֵעֲךָ). This means: love to do him good just as you love him to do good to you. "What is hateful to you, do not do to your fellow." And explain the stranger the same way: "and you shall love him (לוֹ) as yourself" (Vayikra / Leviticus 19:34).

Yismach Moshe And you shall love your neighbour as yourself

Here is the explanation. At first sight it is hard: is this not a love split in two, as the book "Ikkarim" asks? So it says "I am the Eternal": it is known that He is One, and from love of Him flows love of those who love Him, Israel. Think it through. Or it says "I am the Eternal" who commands this. If so, it is one and the same: doing His command. Think it through.

Takeaway

In the words "all the army of Pharaoh" (לְכֹל חֵיל פַּרְעֹה) and "all its vessels" (לְכָל כֵּלָיו) there is also a letter lamed (ל) that does not change the meaning (Shemot / Exodus 14:28, 27:3).
The words "what is hateful to you, do not do to your fellow" were said by Hillel (Shabbat 31a).
"Ikkarim" ("Principles") is a book by Rabbi Yosef Albo on the foundations of faith (Sefer HaIkkarim, introduction).