With what?

And why would it be harder when the target is closer?

Details will help. Possibly you are thinking of something related to apparent size; that would be determined by an inverse tangent, and would depend in part on target size. In the simplest case (an approximation), the apparent width would be inversely proportional to distance; the difficulty of hitting it (in two dimensions) might be proportional to the square of the width. But I can't say anything definite without specifics. After all, my chances of hitting something at 100 meters by, say, spitting at it would be zero!