Neighbor troubles are the worst. I live in the country & to be blunt, strong fences make for better neighbors. Last winter I watched the very same thing happen at my brother-in-law's house. His neighbor let the beagle out. The dog goes across the street & pooed where when the neighbor steps off the top step of her porch, she's going to be in dog poo. The owner of the dog stood in the door, watched the dog take a dump & did nothing to go clean up her dog's mess or to recall the dog away from the neighbors. The whole time I was there, every day I saw the same thing. Dog goes across the street pees, poos, the owner watches & never attempts to be a good neighbor. Not even when she knew she was caught. It was disgusting.
I am a bit unconventional having been a farmer dweller. While in Arizona, we had a problem with a jerk who would walk his dog up the embankment to have his dog pee on our vehicles. This was a senior citizen walking his dog on a leash who would take the dog up to our vehicles, trespassing on our property in order to spritz urine on our car/truck tires & wherever else sparky wanted to pee. I spoke with the not-so-gentleman in person nicely, then firmly, then rather sternly. The old dude wasn't getting it. It was the final straw when he, himself, peed on our truck beside his dog. Okay. So my brain schemed for awhile. What could I do to discourage the dog & man. I tried a few things but ultimately, I went with water. I stretched a hose out under the truck's back tire. That seemed to be pee-wee-sparky's favorite tire. I attached it so I could control it. I put the spray nozzle on steady stream. I experimented with the hose until I could time it right & everything. I got up at 4 a.m. & waited like the true hunter I am. Pee-wee & his wretched human arrived right on schedule, I slipped out of the house like a shadow & got ready. Just as Pee-Wee lifted his leg, the truck peed all over him. I turned the faucet off & on so it was as if a dog was urinating on him. The dog forgot about peeing & jumped away. The old dude, he decided to check it out & got spritzed as well because he was not going to tear up my handy work. So he cussed & fussed as he & Pee-wee-Sparky stomped off down the street. Police told me it was not assault due to the fact the person was trespassing, had been warned multiple times to cease trespassing & did I want to press charges for damages. I told them so long as he & his peeing dog stayed off my property, away from my vehicles, I would work on training my truck not to pee back at them, thank you very much. The police officer who had heard about it held it together until he got in the car but he laughed so hard the whole patrol car shook
A shorter route to this is sprinklers in the front yard. Dog comes in the yard... turn 'em on. Dog leaves, turn 'em off. Rinse & repeat until the dog doesn't want to return to your yard. The water is not harmful or violent. It's not illegal (unless you're on water restriction) & if they won't train their dog(s) sometimes you have to.

At our house now, we just have a HUGE fence. After the neighbor stood there while his male peed all over my herbs, which I eat... FENCE. Love my fence.