As always, the choice of the perfect does not necessarily have a specific meaning.
It has the general meaning "This is a past event with present relevance", but the specific kind of present relevance can vary.
It might be that the activity is continuing into the present:
He's been cleaning that room for hours.
It might be that the activity has only just finished:
He's been travelling all day to get here
It might be that the consequence of the activity is still current.
I've lifted the boxes off the floor.
It might be that the activity is located in a longer time period which includes the present:
I've seen him three times today.
So, in your examples, "He has worked there for three years" probably means that he is still working there, but there are other possible meanings. For example:
Why did they give him such a generous leaving present? Well, he's worked there for three years.
("He worked there for three years" would also be possible: the choice of the perfect suggests that his leaving is very recent).
Similarly, "I've slept for seven hours" is quite normal, if you've just woken up, or if the context for the remark is a longer period including the sleeping:
What have you done today? I've slept for seven hours.
But it would be strange to answer "What did you do last night" that way, because "last night" is a period which has finished.