I could see what part of the exam paper another student seemed to be focusing on, now I'm worried I was cheating I suffer from OCD and intrusive thoughts.

I was once in a test and we were given this extract on a page. I had been analysing the top part of the extract, only. Then, I may have seen the other candidate analysing the bottom part of the extract - I saw nothing of their answer, just their pen moving around that area. The area was quite cramped, in terms of the paragraph space, so I'm not sure what exactly happened, but there definitely wasn't any words or answer/notes she was making on that area. The question was on nostalgia and the quotes that were at the bottom actually referred to remembering and ditching memories. This may have prompted me in referring to the quotes in that certain area. Is this cheating and I feel that this helped me, but I didn't see her notes on it.

My biggest anxiety is cheating. There was a weird compulsion to look around to assure myself that I'm not cheating, if you see what I mean? Yes, I saw the other person analysing that part of the extract, but not her notes or answers on that part/quotes. The question was on nostalgia, and the part that the other candidiate was analysing was right at the end. So, I thought, how about I read the ending, since I was only using quotes from the top. When I read the quotes at the end, they were perfect but I thought that I didn't deserve to use them. Then, I thought, it's on one page, why can't I use it? What if I read this part and summarise it so I can use it. It is really frustrating, because I'm not sure I looked with intent towards her direction; it was a hard extract. I feel like killing myself. This is not the true me!
OCD or similar, if formally diagnosed, could be legally considered a disability. Your school would then be obligated to accommodate your needs in an instructional setting.

Taking examinations in a separate room is a very common form of accommodation for students with mental disabilities. Whoever it is in your institution that deals with students with disabilities will be very familiar with this measure. Schools like it because it's easy and cheap to accomplish.

Given how upsetting this experience seems to be for you, and that it sounds like it wasn't a one-off thing, I'd really advise you to get together with your Office of Disability Services or whatever it's called and figure out a way that you can take exams without having to struggle with these challenges.