In mathematics, a function aims to establish a relationship between an input and an output value. Let us denote the input value as $x$ and suppose that it is real-valued, that is, $x \in \mathbb{R}$. By "$x \in \mathbb{R}$" we mean that "the variable $x$ can take any value in the Real set".
Now consider that we want to apply the function $f$ to $x\in \mathbb{R}$ in order to obtain a real-valued output, $y\in \mathbb{R}$. When we define that the output of $f$ is real, we are actually defining its codomain. By definition, the codomain is the set where the output function is allowed to fall.
Our function (input-output relationship) is given by $y=f(x)=\sqrt{x}$. Note that we have one limitation: although $x$ can take any value in the real set, the function $f$ only accepts nonnegative real-valued values since negative values of $x$ would yield imaginary values, which do not belong to $\mathbb{R}$ (the codomain of $f$). This "input set limitation of $f$" is exactly the domain of $f$. With the definition of both domain and codomain of $f$, we can denote $f$ as $f: \mathbb{R}_+ \rightarrow \mathbb{R}$[¹]. You can read this as $f: \text{domain} \rightarrow \text{codomain}$. We can conclude that a function is completely defined only when we also define its domain and codomain, where these sets are part of the definition of $f$ rather than a property of it [1]. We can denote the domain of $f$ as $\text{dom }f = \mathbb{R}_{+}$ or $\text{dom}(f) = \mathbb{R}_{+}$, it depends on the author. As far as I know, there is no notation to denote the codomain of $f$ [2].
Note that, although the codomain of $f$ is $\mathbb{R}$, it will only yield nonnegative values. This whole set of nonnegative values is exactly the "image of $f$ set" or range. By definition, the image of $f$ is the set of all output values that $f$ may produce [3], that is, it is the set $f(\text{dom }f) = \{f(x) \mid x \in \text{dom }f\}$. The range is a subset of the codomain (in some cases, it may cover all the codomain). The mathematical notation for the image of $f$ or the range is $\text{ran }f = \mathbb{R}_+$ or $\text{ran}(f) = \mathbb{R}_+$ [4], $\text{range }f = \mathbb{R}_+$ or $\text{range}(f) = \mathbb{R}_+$ [5], or $\text{im }f = \mathbb{R}_+$ or $\text{im}(f) = \mathbb{R}_+$. The notation varies considerably depending on the author. You can also use the term "image" in elementwise manner, that is, if $f(a)=b$, you can (and should) say that "$b$ is the image of $a$". The term "range" is not used in elementwise manner [6, appendix B.3].
To make the understanding of preimage clearer, it is convenient to introduce another definition of set theory that was not asked. In many fields of Mathematics, such as Optimization Theory, we are only interested in a subset of the domain rather than the whole domain. Formally, we must define another function, $f\mid_A$, where its domain $A$ is a subset of $\text{dom } f$, that is, $A\subseteq \text{dom }f$. $f\mid_A$ is referred as the restriction of the function $f$ in $A$ [7]. But for most cases, it is more convenient to work with $f$ itself and assume that we are only interested in what happens with the region of interest, $A$. In this case, the image of $A$ is denoted as $B = f(A) = \{f(x)\mid x\in A\}$, and its preimage (or inverse image) is defined as $f^{-1}(B) = \{x \in \text{dom }f\mid f(x) \in B\}$, where $f^{-1}$ is the inverse function of $f$. Note that $f^{-1}(B)$ is not necessarily equal to $A$, it depends whether the function $f$ is biunivocal.
PS:
[¹]: I am using the French notation to denote the nonnegative sets, the notation of this set may vary by author.