I'll bet a metal detector would detect water pipes and cast iron drains. If the walls are drywall, most people just drill and stop when the drill penetrates to the wall cavity, then they use a dowel or wire to feel for pipes or electrical cables. Bore scopes should be even better and are getting much less expensive.
Best construction practice is to use steel armor plating between drywall and stud or bottom plate in places where pipes and wires penetrate.
Unless you know for sure there is no electrical cable or pipe in the wall where you want to drill into a stud or into the bottom plate use the shortest screws that will hold in stud. Usually 2 inches or less will keep you out of screwing into a pipe.
I think that finish carpenters try to be aware of where pipes are when installing baseboards.