If used
well, I think you can get the greatest mileage out of a derelict spacecraft - it's just among the easiest to screw up.
But part of the advantage with a spaceship or station is that, because they exist currently in more of a speculative space - unless you decide you wanna go relatively low-tech on the sci-fi and do a horror aboard say, the ISS - you can tailor it as to basically whatever you desire to play around with the mood, where an environment situated on Earth runs into the issue of having to fit the template of the locale and its expectations. And as
Tharp says, a spacecraft inherently rationalises why you can't just leave - it's fucking
space, you're not going aware without a separate escape craft.
Prey is a really good example of how one can play with the dimensional space to great effect. You can have tight, narrow corridors in which there is little escape from immediate, obvious threats. Or you can have wide, open spaces that almost look
pleasant, and so are difficult to discern just where a threat - if there even is any - might come from. Because the vessel is a construct, it can have potential points of entry that are less intuitive in a more natural environment but totally make sense in a wholly artificial one: ventilation shafts, particularly running through the floor ('the ground' being not so easily traversed except on top of it planetside), are an infamous unto a tad cliché example of this. You can also more easily screw with the rules of the environment without even technically invoking anything spooky - gravity can just turn off on a space station, whereas on Earth that would immediately be a suggestion of something otherworldly at work.