"Have you seen him recently?" or "Did you see him recently?" [closed]

They are both correct but are used in different contexts.

If John is visiting this country I might ask someone, "Have you seen him recently?" If John is no longer in this country I might ask, "Did you see him recently?"

In the first question, seeing John is still possible. In the second, the opportunity has gone.

If someone has recently died it would sound very odd to ask a friend of his, "Have you seen him recently?" though you could ask, "Did you see him recently?"

At - or soon after - lunchtime you might ask your friend, "Have you had lunch?" A few hours later, when lunch is no longer available, you would ask, "Did you have lunch?"