How can I build a fence next to existing neighboring fences?
I would speak with both neighbors before installing anything.

Then, I would start by establishing how close to the property line the neighbor's fences are, and set end posts about the same distance inside the line.  You could then add  a small "make-up" piece to fill the gap, or if the posts are nearly against each other, perhaps a decorative panel, trellis, or similar could be used to cover the small gap.

This way, if a future owner on either side decides to remove their fence, the integrity of your fence will not be affected, and the corners will be in the right place to add a run down the your side of the side property lines.