Colloquial idiom used to describe someone or something that is annoying, irritating, or bothersome. It's a less vulgar way of expressing frustration or annoyance than some other expressions that convey similar meaning. The phrase likens the annoyance or inconvenience to physical discomfort or pain, although it is meant to be understood metaphorically rather than literally.
The origins of the phrase are not definitively documented, but it's a variation of similar expressions that liken annoyance to physical discomfort in various body parts ("pain in the back," "thorn in the side," etc.). The use of "neck" in the phrase could be symbolic, as the neck is a sensitive and vital part of the body that is crucial for movement and support of the head.