Sarah has given you an answer from an American perspective. I presume you learnt those expressions from a British English context, so here's the British perspective:
Your sentences are correct in British English, but you should only use them with small children.
In Britain, we do in fact use the verb 'do' for what Sarah euphemistically calls bathroom habits :), but only with children. A young child, or an adult talking to a small child, would use the phrase "do a poo" or "do a pee", or more commonly "do a wee".
It would be very strange if anyone over the age of about six were to use these expressions - they sound like 'baby-talk'. Older children and adults might possibly use the same nouns ( pee or wee, and poo), but with a different construction:
I need a ...
I need to have a ..
I need to go for a ..
Those are all natural expressions that you might use with close friends or family. They are 'direct', shall we say, but not vulgar. For example, I've been in situations at work, when a female colleague I know well has said to me 'I must just go for a wee. I'll be back in a minute.'. This comes over as friendly and informal, rather than crude.
There are a number of crude and vulgar words for these toilet functions, which you would do well to avoid. They all have four letters in them.
"I need to go to the bathroom" is American English.
In British English, by far the most common term polite term for a toilet is the informal word 'loo'. You can safely use this with friends, family, colleagues and strangers - anyone, in fact. Common phrases are 'I need the loo' or 'I need to go to the loo'. It's slightly more polite to say something like 'I must just go to the loo' , or to use the very British 'I'm just going to pop to the loo' or 'I'm just going to nip to the loo' - both of these imply a quick trip that won't delay anyone.