An ongoing study by IIT Kharagpur shows that civilization may have existed in Varanasi as long as 4500 BC. My question is inspired by this study. What are the references available to Varanasi or Benaras in Ramayana and Mahabharata?
I'm not sure about Ramayana, but Varanasi is certainly mentioned in Vedas and Mahabharata. I discuss about Varanasi in Vedas in my answer here. The Mahabharata also mentions the name Varanasi and Kasi many times. In the city Varanasi also the place where Lord Avimukta is present (Visweshar Linga) is the most sacred. The Mahabharata in the Vana parva Tirtha Yatra section also talks about the glory of Varanasi and Lord Avimukta there. It's in this chapter of Mahabharata:
ततो वाराणसीं गत्वा अर्चयित्वा वृषभध्वजम् ।
कपिलाहृदे नरः स्नत्वा राजसूयमवाप्नुयात् ।।
अविमुक्तं समासाद्य तीर्थसेवी कुरुद्वह ।
दर्शनाद् देवदेवस्य मुच्यते ब्रह्महत्यया ।।
प्राणानुत्सृज्य तत्रैव मोक्षं प्राप्नोती मानवः ।।
Proceeding next to Varanasi, and worshipping the god having the bull for his mark, after a bath in the Kapilahrada, one obtaineth the merit of the Rajasuya sacrifice. Repairing then, O perpetuator of the Kuru race, to the tirtha called Avimukta, and beholding there the god of gods, the pilgrim, from such sight alone, is immediately cleansed of even the sin of slaying a Brahmana. By renouncing one's life there, one obtaineth Moksha.
Thus the most glory of Lord Avimukta in Varanasi is that anyone who dies there attains moksha. As the above Mahabharata sloka states " प्राणानुत्सृज्य तत्रैव मोक्षं प्राप्नोती मानवः ।।" ie. "One who gives away Prana there (Prãnutsrijya tatraiva) is sure to obtain Moksha (Moksham Prãpnoti Mãnava)
As a Sidenote, Lord in Varanasi is called Lord Avimukta because Varanasi is never forsaken by Lord Shiva. And Avimukta literally means which is never forsaken. As described in answer here Kashi is not destroyed by Lord Shiva even after completion of Kalpa:
ब्रह्मणश्च दिने सा हि न विनश्यति निश्चितम्।
तदा शिवस्त्रिशूलेन दधाति मुनयश्च ताम्।। २३ ।।
Even after the completion of a divine day of Brahmā, the city of Kāšî does not get destroyed. O Sages, at that point of time, Siva holds it over the tip of his trident.
पुनश्च ब्रह्मणा सृष्टौ कृतायां स्थाप्यते द्विजाः ।
कर्मणां कर्षणाचैव काशीति परिपठ्यते॥ २४॥
O Brähmanas, then Brahmā again recreates the universe, then he again establishes Kāśī. Because of the bondages of the karmas and their attraction thereto, it is called Kāši.