…or one who consults the dead. (Deuteronomy 18:11)
One may also not “cut out the middleman” by skipping the medium and going directly to the dead. Trying to get the deceased to come to you in a dream and tell you what to do is likewise forbidden.
The underlying rationale of this prohibition is that God wants us to come to Him. Trying to whistle up dead people for help is a huge slap in the metaphorical face to Him. It is a detestable practice, approaching idolatry.
This mitzvah applies in all times and places. It is discussed in the Talmud in tractate Sanhedrin (pages 65a-b) and codified in the Shulchan Aruch in Yoreh Deah 179. This mitzvah is #38 of the 365 negative mitzvos in the Rambam’s Sefer HaMitzvos and #174 of the 194 negative mitzvos that can be observed today in the Sefer HaMitzvos HaKatzar of the Chofetz Chaim.