Block on Trump's Asylum Ban Upheld by Supreme Court
Restraining orders do what they say, which is restrain the movements of someone who is endangering another. But because you are seeking to restrict someone's freedom, it's not easy to get a restraining order and you will have to show evidence that contact is dangerous or threatening before a judge can order someone to stay away, especially your neighbor.
When the person who you want to restrain is your neighbor, the proximity of your living spaces certainly complicates matters. It's likely you will have to show fairly extensive evidence that your neighbor poses a threat before you get an order demanding maintenance of a safe distance. Still, it can be done, so let's consider.
Apart from specifying the distance that a dangerous person must keep from someone they are threatening, a restraining order can prohibit specific behaviors or actions. What the order will restrict is whatever you can specifically show the court has been taking place and is threatening to you. So, say you are getting threatening calls from an ex, plus the person is stalking you, you would seek to restrain the phone calls and the person's ability to follow you.
What the restraining order actually does is pretty limited. Obviously the paper itself doesn't protect you. What it does is create serious legal consequences for violations of its terms. The restraining order allows you to call the police and seek an arrest of the person threatening you even if what they're doing is technically not a crime (for example, calling someone).
If you are having a dispute with a neighbor and seek a restraining order, you will have to show the court how your neighbor's proximity threatens your safety. The best way to prove anything is with details. You can't just file a document with the court saying your neighbor gives you a creepy feeling and you need him to stay away. Instead, specify what it is that the neighbor's doing that's threatening -- are you being followed, or is the neighbor hanging around under your windows, or something else altogether?
Consult With Counsel
If you're concerned about a neighbor's behavior or otherwise need assistance with a legal matter, talk to a lawyer. Tell your story. Get help filling out the appropriate forms and handling the hearing in court. Many lawyers consult for free or a minimal fee and will be happy to provide some initial guidance.