The first form uses "do" as an auxilary verb. The auxiliary verb "do" is used for emphasis (I do love you) and to form questions and negative statements. When used as an auxiliary, "do" can be in present or past tense and it has an inflected form for the third person singular (does). The main verb does not change for person for tense. The verb "do(n't) need" often takes an infinitive as a complement. "I don't need to read that book."
The second form uses "need" an an auxiliary verb. When "need" is an auxilary verb, it does not have a past tense and it doesn't change form to agree with the subject. The main verb following "need" is the base or infinitive form without "to". If a past tense is desired, the main verb is replaced by "have" + "past participle". "John needn't leave for another hour." "You needn't have done that."