Jesus is the first and the last in the sense that he is the first creation, and the first to be resurrected from the dead, and the last Adam. None of these apply to God who cannot die and was not created.
Senior biblical scholar Adela Yarbro Collins explained it this way:
It is not necessarily the case that the same attributes have exactly the same significance for Christ as they have for God. For example, in light of 3:14, the affirmation that Christ is the beginning and the end in 22:13 may be understood as signifying that he is both the beginning and the fulfilment of the creation of God. Thus his being "the first and the last" (an affirmation not made about God in Revelation) could also mean the first creature of God and the agent of God at the end. All of the affirmations are more like poetry than like philosophy, so it is difficult to determine whether the author considered Jesus to be an aspect or emanation of God or the first creature of God, or whether he thought about this issue at all. The notion that Christ was the first creature of God is compatible with his being the principal angel.
Collins, A. Y., & Collins, J. J. (2008). King and messiah as son of God: Divine, human, and angelic messianic figures in Biblical and related literature, page 194.