Lord Rama and Lord Krishna are the avatars of Brahman. Even we are also the avatars of Brahman only.
Let me explain how.:
" R ^ itam satyaM paraM brahman purushha.n KR ^ ishhNapi ~ Ngalam.h | uurdhvareta.n viruupaakshan vishvaruupaaya vai namo namah 1 " ( Taittiriya Aranyaka 10.23.1 ) "
Supreme Brahman" , the Absolute Righteousness ( rita ) and Truth ( satyam ) , is the androgynous purusha the Ardhanareeshwara (Uma Maheshwara), dark blue and reddish brown in hue , absolutely chaste ( having semen raised up ) and possessing uneven eyes ( three eyed ) . Salutations to him / her."
10 Avatars of Lord Vishnu.:
According to Padma Purana Uttarkhanda chapter 71.26-29
Matsya, Kurma, Varaha, Narsimha, Vamana, so also Parasurama, Rama, Krsna, Buddha, and after him is said to be (the incarnation of) Kalki. These ten are said to be (Visnu's) ten incarnations on the earth.
Lord Narayana as Brahman being the part of Brahman.:
According to Ishwar Gita Chapter 6.:
योऽपि नारायणोऽनन्तो लोकानां प्रभवाव्ययः । ममैव परमा मूर्तिः करोति परिपालनम् ॥ ६.१४॥ Meaning: - The endless Narayana, origin of world(s), is my (Lord Shiva's) best form and by my blessings he sustains entire creation.
Lord Krishna as Brahman.:
According to Mahabharata Drona Parva.:
“sa eṣa rudra bhaktaś ca keśavo rudra saṃbhavaḥ | kṛṣṇa eva hi yaṣṭavyo yajñaiś caiṣa sanātanaḥ |
sarvabhūtabhavaṃ jñātvā liṅge ‘rcayati yaḥ prabhum | tasminn abhyadhikāṃ prītiṃ karoti vṛṣabhadhvajaḥ |” (MBH 7:172:89-90)”
“Kesava is that devoted worshipper of Rudra who has sprung from Rudra himself. Kesava always worship the Lord Siva, regarding his Phallic emblem to be the origin of the universe. In Kesava is always present that knowledge, in consequence of which he views the identity of Brahman with the: universe and that other knowledge by which the Past, the Present and the Future, the near and the remote, are all seen, as if the whole are before his eyes. The gods, the Siddhas and the great Rishis, adore Kesava for obtaining that highest object in the universe, viz., Mahadeva. The Lord Kesava always worshippeth Siva in the Phallic emblem as the origin of all creatures. The God having the bull for his mark cherisheth greater regard for Kesava”.
Lord Rama as Brahman.:
According to Rama Rahasya Upanishad.:
"raama.n trinetra.n somaardhadhaariNa.n shuulinaM param.h
bhasmoddhuulitasarvaa~Nga.n kapardinamupaasmahe " (Rama Rahasya Upanishad 2:32)
I worship that Rama, Who has three eyes, Who wears the crescent, Who holds the trident, Who is anointed all over by ash, And who is with matted hair".
The Shanti Parva (Chapter 342) of the Mahabharata
“ahamAtmA hi lokAnAM vishvAnAM pANDunandana tasmAdAtmAnamevAgre rudraM sampUjayAmyaham yadyahaM nArchayeyaM vai IshAnaM varadaM shivam AtmAnaM nArchayetkashchiditi me bhAvitaM manaH”
“I(Krishna/Vishnu) am the Soul, O son of Pandu, of all the worlds, of all the universe. Rudra, again, is my Soul. It is for this that I always adore him. If I do not adore the auspicious and boon-giving Isana nobody would then adore my own self.”
Lord Krishna to Lord Shiva in Harivamsa Parva.:
“ahaM brahmA kapilo yo.apyanantaH
putrAH sarve brahmaNashchAtivIrAH |
tvattaH sarve devadeva prasUtA
evaM sarveshaH kAraNAtmA tvamIDyaH ||2-74-34]”
O the lord of lord (Shiva)! Myself:(Krishna/Vishnu), brahma, kapila, ananta (sheSha), all the valiant sons of brahma who conquered over the internal enemies - all are created from you. Hence you are the lord of all. Hence you, the lord of all, are only worthy of praise and worship.
That's why Dashavataras are the incarnations of Brahman only.:
According to Padma Purana Uttarkhanda Chapter 229
Thus the state of the inner controllership of self consists in his being the innermost soul. Matsya, Kurma, Varaha, Narasimha, Vamana, Rama, Parasurama, Krishna, Buddha and Kalki are the ten incarnations of Brahman, the highest soul.
We mortals as Brahman.:
The Self is None other then Lord Shiva.:
देहो देवालयः प्रोक्तः स जीवः केवलः शिवः ।त्यजेदज्ञाननिर्माल्यं सोऽहम्भावेन पूजयेत् ॥ (Maitreyi Upanishad II:1)“The body is said to be the temple; the individual Self (Jiva) is Shiva alone. One should discard the faded flowers in the form of spiritual ignorance and worship God (with the conviction) ‘He and I are one’.
Ishwar Gita Chapter 2.:
सर्वकामः सर्वरसः सर्वगन्धोऽजरोऽमरः ।
सर्वतः पाणिपादोऽहमन्तर्यामी सनातनः ॥ २.४७॥
Meaning: -Know me to be antaryamin (inner self of all beings), eternal, desire (ultimate destination to reach) of all, fragrance (outcome) of all (actions), essence of all (veda), unborn, immortal and having hands and feet in every direction.
It is Lord Shiva who exist in the form of Jivaatma-Inner Self of all.
” (Sri Rudram, Yajurveda IV:5:8:o)“Salutations to Him (Rudra) who is born again and again in Samsara and who tastes the fruits of Karmas in the form of Jiva”.
पशुपतिरहङ्काराविष्टः संसारी जीवः स एव पशुः । (Jabali Upanishad 1.2)“Jeeva (being) is nothing but Shiva (the Lord of all beings – Pasupathi) himself who is acting the role of egoism”.
Atmasa.nj~naH shivaH shuddha eka evAdvayaH sadA |
brahmarUpatayA brahma kevalaM pratibhAsate |” (Atma Upanishad 2:1)
“The Atman – the Shiva, is pure, one and non-dual always, in the form of Brahman. Brahman alone shines forth”.
“maayaa.n tu prakR^iti.n vidyaanmaayina.n cha maheshvaram.h | tasyavayavabhuutaistu vyaapta.n sarvamida.n jagat.h |” (Swetasvatara Upanishad 4:10) “Know then Prakriti (nature) is Mâyâ (art), and the Maheshwara the Mâyin (maker); the whole world is filled with what are his members (forms)”.
CONCLUSION: - It is clear that Lord Shiva exist as innerself of all. And as this Jiva is nothing but Shiva, hence it is eternal. That's why we say "Aham Brahmasmi" (I AM BRAHMAN) or "Shivohom" (I AM SHIVA).
I hope this clears your doubts...