In Civilization V, Declarations of Friendship fill the role of alliances. AI civs will offer more favorable trades after declaring friendship with a partner, and can also form Research Agreements. Declaring friendship does not prevent either civ from denouncing or declaring war on its partner, however.
In Civilization VI, forming an alliance with another civ prevents both allies from denouncing or declaring war on each other. It also provides Open Borders and Shared Visibility, allowing each ally to see everything on the map that the other's units and cities can see. The Rise and Fall expansion adds new types of alliances that provide various and evolving benefits.