eternal-hope7 said:
John 19:30 or Luke 23:46?
Luke 23:46 And when Jesus had cried out with a loud voice, He said, "Father,
into Your hands I commit My spirit." Having said this, He breathed His last. NKJV
John 19:30: So when Jesus had received the sour wine, He said,
"It is finished!" And bowing His head,
He gave up His spirit. NKJV
"He gave up His spirit" refers to Jesus' words in Luke 23:46. The Gospel of John is the only book in which both events are recorded together. The written sequence alone shows that the last words on the cross were, "Father, into Your hands I commit My spirit."
Perhaps your uncertainty is due to a slight ambiguity in the Bible translation you are reading. Here are several different presentations of John 19:30 (taken from an online Bible search):
ASB: When Jesus therefore had received the vinegar, he said, It is finished: and he bowed his head, and gave up his spirit.
NASB: Therefore when Jesus had received the sour wine, He said, "It is finished!" And He bowed His head and gave up His spirit.
GNT: Jesus drank the wine and said, <<It is finished!>> Then he bowed his head and gave up his spirit.
* *
CEV: After Jesus drank the wine, he said, "Everything is done!" He bowed his head and died.
NLB: Jesus took the sour wine and said, "It is finished." He put His head down and gave up His spirit and died.
NIV: When he had received the drink, Jesus said, "It is finished." With that, he bowed his head and gave up his spirit.
KJV: When Jesus therefore had received the vinegar, he said, It is finished: and he bowed his head, and gave up the ghost.
NLT: When Jesus had tasted it, he said, "It is finished!" Then he bowed his head and gave up his spirit.