寺院 -> more formal term for a Buddhist temple, but you can put religion X, or Xの in front of it to get an "X temple"
神殿 -> most generic term for a temple, you'd use this for any kind of temple e.g. an ancient Greek temple. Generally, it is expected that people perform/ performed religious activities there.
there are specific words for buildings used by other religions