Repulsion of random and self-avoiding walks from excluded points and lines