I've seen some words with とお and とう and I was wondering how are you supposed to know which one, and if there is any difference in pronunciation.
I guess you mean how to know which kana to use for a word that you've heard, but don't know how to write?
I'm not a native speaker, but I think the pronunciation difference is quite subtle. It might be difficult to know which one if you hear a word for the first time. Comparing とお in 遠い to とう in 当然 for example, I don't think I'd be able to guess if I heard them for the first time, and didn't know the kana already.
That said, as a rule of thumb, I feel that とう is much more common, so if you're not sure that's probably the safer guess. Other than that, depending on your vocabulary, how well you know kanji pronunciations, and whether you know or can guess the meaning of the word from context, you might be able to make a guess at which (if any) kanji is used, and from there know which kana.