Verb + en, sur, contre, avec, par, pour
s'entendre
avec
The constructions
avecs'entendre avec quelqu'un
Meaning : to get on with someone
Je m'entends bien avec mes collègues.
surs'entendre sur quelque chose
Meaning : to agree on something
Ils se sont entendus sur le prix.
Why
S'entendre avec quelqu'un is to get on with them. S'entendre sur quelque chose is to reach agreement. Se disputer avec, se réconcilier avec follow the first pattern.