Help with getbounds

can some one tell me how to stop mc with walls by get bounds?
and explain me how its works?