How to prevent papers from being published in advance by others?
If I upload the paper to arxiv, will others not be able to use the same idea as me?

They absolutely can, but because you have uploaded your paper, you have established precedence: you can claim you had the idea and did the work first. Others can still use your idea (and you should feel flattered they do!) but they would have to cite you.
There are many papers on the arXiv that have accumulated lots of citations but have never been published in journals, e.g. this one. If the authors of that paper ever submit it to a journal, there's a high chance it will be published quickly, simply because it is so impactful.