I think this might be just what I am looking for.
To be more specific with what it is I want to do, I want a player to walk into a corridor and when the player comes within 2 block from the command block, it sends a signal that triggers the redstone that I have connected to a trapdoor.
I have yet to try what you told me but if that is what it'll do then it's just what I needed!