Hartshorne defines a rational map $\phi: X \rightarrow Y$ between two varieties to be an equivalence class of pairs $\langle U, \phi_{U} \rangle$ of open subsets and morphisms $\phi_{U}: U \rightarrow Y$ on them, with equivalence relation given by $$\langle U, \phi_{U} \rangle \sim \langle V, \phi_{V} \rangle \iff \phi_{U} \mid_{U \cap V} = \phi_{V} \mid_{U \cap V}.$$
Lemma I.4.1 right before this definition gives us that two morphisms $\phi, \psi: X \rightarrow Y$ which agree on open $U \subset X$ will actually be equal.
So, this makes me think that the equivalence relation in the definition of rational map above is really just equality, and so a rational map would be exactly one map on an open subset of $X$? But I realize this could be wrong since the lemma describes its two morphisms to have domain all of $X$ instead of just quasi-(affine, projective) varieties.
Also for regular functions: if two regular functions $f: U \rightarrow k$, $g: V \rightarrow k$ agree on the overlap $U \cap V$, then by denseness of $U \cap V$ (since it is open in an irreducible space $X$) I would assume $f = g$ on all of $X$. Is this correct thinking? There are many exercises that deal with these types of situations, and given my possible misconception above they all seem very trivial, so I must be missing something here.
I would like some help to clear up my confusions.