If there is pain while urinating, do you need to do ghusl before praying? what is the procedure for ghusl?

thanks