The iPhone 8 and 8 Plus is not waterproof — no smartphone is and in a break with past iPhones, Apple now designs for an IP67 rating for dust and water-resistance. You can read more about how IP ratings work here.
In a nutshell, as far as water is concerned, an IP rating of 67 means your iPhone 8 can be fully submerged in up to 1 meter of water for up to 30 minutes without being damaged.
So, will an iPhone 8 die if it takes a brief dip in water that’s deeper than 1 metre? No.
Will it survive for over a half hour or so in about 5cm (2") of water? Yes.
What this all means is that an iPhone 8 (that isn’t cracked or otherwise compromised) will survive a water accident that caused significant damage and function degradation to older iPhone hardware.
In terms of steam, no, it's not officially rated against that criteria (from memory it'd need to have an IP rating of 69 for that).
However, if you're just talking about leaving it on the bathroom bench while you have a shower, then it'll be fine1 assuming it's not going to be in there for a prolonged period of time and that the steam isn't produced from extremely high heat.
1. Based on the fact I have two teenage daughters who have used iPods and iPhones like this for years (and they don't even have an IP rating)!