The Greek in John 17:4 is in an unqualified past tense called the aorist, which does not refer to the duration or completion of the action. The Greek of John 19:30, however, is in the perfect tense: it is something that has definite, present results.
Also, slightly different Greek verbs are used. The verb in John 17:4 is τελειόω, while John 19:30 uses τελέω. Both have as their root the word τελος, meaning "end", but τελέω carries an additional shade of meaning, perhaps, of accomplishment or fulfillment (cf. All things were now accomplished, John 19:28 KJV).
"The work of the Only-begotten Son Incarnate," as described in one Byzantine Greek commentary (Theophylact, 1055-1107) "is to sanctify our nature; to overthrow the ruler of this world, who made himself out to be God; and to plant the knowledge of God in the creation" (Explanation of the Gospel of John, tr. Chrysostom Press, p.257-58). "But how," continues Theophylact, had He finished this work when it was hardly begun?"
Indeed, Christ has already accomplished the greater part by implanting
in us the root of every good: He conquered the devil, and by flinging
Himself into the maw of the all-devouring beast of death. From this
would follow by necessity all the fruits of the knowledge of God. It
is in this sense that He has finished the work. I have sown, I have
planted the root: the fruits are sure to follow.
Ibid. *
The use of an imperfect tense here makes sense, though, since the work of salvation would only be perfected through the crucifixion and death of Christ. When John 19:30 was translated into Latin the phrase "consummatum est" - "it is consummated" - was used. Christ's work on earth was complete, but God's full oekonomia was yet to be fulfilled. For this reason, after affirming that he finished the work which You gave Me to do, asks the Father And now glorify Me.
* The full text of Theophylact's commentary on v.4-6:
I have glorified Thee on earth: I have finished the work which
Thou gavest Me to do. And now, O Father, glorify Thou Me with Thine
own self with the glory which I had with Thee before the world was. I
have manifested Thy name ...
We learn from this that the Father glorifies the Son in the same
manner as the Son glorifies the Father. I have glorified Thee on
earth, Christ declares. Quite rightly did He add, on the earth,
for the Father was already glorified in the heavens and worshipped by
the angels, while the earth lay in ignorance. Having proclaimed the
Father to all, the Son now declares, "I have glorified Thee
everywhere on earth by imparting the knowledge of God, and I have
finished the work which Thou gavest Me." The work of the
Only-begotten Son Incarnate is ... [see above]. O Father, glorify Me
with Thine own self which the glory which I had with Thee before the
world was formed." At that point the nature of flesh had not yet
been glorified: it had not been made worthy of incorruption and of
sharing the royal throne. This is why the Lord declares, Glorify
Thou Me, meaning, "Receive My dishonored and crucified human nature,
and raise it up to the glory which I - the Son and Word of God -
had with Thee before the world was." After His ascension, Christ in our human nature was seated on the royal throne and now He is
worshipped by all creation. Then Jesus explains His words, I have
glorified Thee on the earth, meaning, *I have manifested Thy name."
How is it that the Son was first to manifest God's name, when Isaiah
said, They ... shall swear by the true God [Isaiah 65:16]? As we
have often pointed out, God's name was already revealed, but only to
the Jews, not to the whole world. Now Christ announces that God's
name will also be revealed to the Gentiles, since He has destroyed the
devil, the teacher of idolatry, and planted the seeds of divine
knowledge. If at any point the pagans already had some knowledge of
God, it was only as creator-demiurge, not as Father. The Son revealed
that the creator was the Father. Moreover, by His own words and
deeds, Christ revealed not only His Father, but Himself.