Halasana or any inversion should be first practiced under an expert’s guidance. People with back problem, neck pain, especially arthritis of the neck should avoid this posture.
Considering you have pain after practicing the posture, there is a possibility that you have most likely put pressure on the cervical spine (neck) thus it is feeling strained.
On the contrary, the neck and back should feel relaxed in this posture. As mentioned, it is important to learn this posture’s alignment from a teacher and also practice it under their guidance.
To be safe, they also recommend the use of props like blanket to cushion your shoulders or wall-support , etc. And a counter-pose like Matsyasana as soon as you come out of Halasana.
If it is a neck sprain and you feel better within couple of days great. If not, please get a medical evaluation and do not try any other stretch until you have understood the cause of pain/discomfort.
If you want to practice this posture, please learn it from a qualified yoga teacher.