Is there some kind of rule about how to use the words demand and need correctly?
It isn't that there is a rule - it's understanding the difference in meaning between the two words:
demand : as a noun
an insistent and emphatic request, made as if by right : eg 'a series of demands for changes in the law.' - 'the demands of his job mean he has little time to spend with his family.'
as a verb: He demanded an apology
need : as a noun
circumstances in which something is necessary, or that require some course of action; a necessity : 'the basic human need for food' - 'there's no need to cry.'
a thing that is wanted or required because one is lacking some basic necessity - 'After the typhoon, the homeless needed temporary housing.'
as a verb
• the state of requiring help or support; ' I need you help to move this table'
require (something) because it is essential or very important : 'This shirt needs washing.'