Some colleagues just drive us nuts. It's the things they say or do or how they talk to us. It's not even one single thing that can summarize a difficult colleague. Some people find it difficult if others complain all the time and others if someone is unreliable.
Everything is a matter of perception
The first thing that we have to keep in mind when confronted with a difficult colleague, is that everything is a matter of perception and everything can be reframed. If you take someone who you would say is very critical or always complaining, keep in mind that someone else might find the person has an eye for the details or is very quality driven.
Practicing to see the other side of things - according to the development square by Schulz von Thun - can be a good way to start seeing the grey between the black and white. A good exercise is, to note down all the things that you find difficult about your colleagues. Also note down all the things you think your colleagues find difficult about yourself. Then go through the exercise and reframe the things: picky might become 'knows what he wants', critical becomes thoughtful etc. If you do the exercise together with a couple of colleagues it might be easier.
To learn how to deal with someone who is attacking or shouting at you, it's best to have a strategy that you iteratively adjust.
Don't get emotional
Don't put emotions into a situation that you don't want to escalate. Make sure to find some excuse that allows you to leave the situation or get back to the person later on. So let's say a colleague tells you 5 minutes before you will present the project plan to your boss that he already made a better proposal yesterday and forgot to tell you. Don't explode, stay professional, suck it up for now. You can talk to the person later, when you have obviously rational arguments for why that was totally inacceptable and what you suggest for the future.
If there is something about someone that drives you completely nuts, question yourself if it's you. There are some things that you might project onto others: Maybe the person reminds you of your ex-partner and by now you hate that person. Or you are a person that feels criticized easily and everything you hear from that specific person is criticism - that might have nothing to do with what the person is actually trying to communicate. Check with other people how they perceive the person and reflect on yours. On top of that, start focusing on the positive things and strengths of the person. The halo effect might just ruin the person for you.
Talk to the person
Don't talk behind her / his back but approach the person directly. If you start bitching about the person it's not fair play anymore and will eventually backfire on you anyways. Seek the conversation and try to follow the steps for negative feedback. Keep it on the objective level and use 'I messages'.
Keep your distance...
... if all the rest has not been working. That doesn't mean that you have to avoid the person completely - schedule the relevant and important meetings. Don't have unnecessary conversations about private life and don't pretend to be best friends with him / her.
How to handle attacks
If you feel attacked in a meeting or personal conversation, it's also good to be prepared and have a strategy for it. There are some killer phrases people are using to make you shut up or turn down your idea within a second. That would be something such as "We have to do it like that. The customer wants it that way." or "That doesn't make any sense." Try to find out what the person really wants to tell you with that and don't feel intimidated. Your answer could be something like "What exactly does the customer want. How did you find out about it? How big is the data base?" etc.
On top of that, it's good to have one sentence prepared how to handle an attack. You could be using a sentence that confuses the other person e.g. "Look at that." or "Oh well." and buys you some time. Or you can start out with something that builds up a bridge to your actual reply - "Oh that sounds interesting, let me think about it." this one also buys you some time to come up with an answer. Pick one sentence that you feel comfortable with and start using it: If you are attacked, your brain stresses out and you might be loosing your repartee.