How can I be sure about using both?
In general 'which' is used when there are relatively few options or the options are limited and 'what' is used where there are many or unlimited options.
Which film do you want to watch tonight? This one or the one on channel two?
What is your favourite film of all time?
However, sometimes you could use either because what constitutes 'few' or 'limited' is decided by the speaker at the time of speaking.