Are random variables mathematical functions when dealing with continuous sample spaces? I'm struggling with some basic concepts regarding the definitions of random variables.
If I'm not mistaken, random variables are functions which aim to "translate" outcomes of a sample space to a measurable space. As an example, the sample space composing the possible outcomes of a coin toss would be "head" or "tails". By assigning a mathematical function to these values, we can define them as ${[0,1]}$, allowing further analysis such as inferring the probability distribution of outcomes along multiple trials and the expected value of such a distribution.
The necessity of defining discrete outcomes as a random variable is pretty clear to me. What I do not understand is what kind of transformation a interval within a continuous sample space undergoes to be defined as a continuous random variable. Is there any difference between these two definitions (continuous sample space x continuous random variable)? Why do we define the probability distribution of a continuous random variable, instead of the probability distribution of a continuous sample space? Is it just a formalization?

First, a basic commentary:
$\bullet$ Let $(\Omega, \boldsymbol{ \mathfrak A}, \mu)$ be a measure space. Let $f$ be a real-valued function on $D\in \boldsymbol{ \mathfrak A}.$ Consider another measure space $(\Omega^\prime, \boldsymbol{ \mathfrak B}).$ $f$ is $\boldsymbol{ \mathfrak A}$-measurable on $D$ if and only if $f$ is $\boldsymbol{ \mathfrak A}/\boldsymbol{\mathfrak B}$ measurable mapping of $D$ into $\Omega^\prime$ that is, $f^{-1}(\boldsymbol{\mathfrak B})\subset \boldsymbol{ \mathfrak A}.$
$\bullet$ Let $(\Omega^\prime, \boldsymbol{ \mathfrak A^\prime})$ be a measurable space; let $X:\Omega \to \Omega^\prime$ be measurable. $X$ is a random variable  with $(\Omega^\prime, \boldsymbol{ \mathfrak A^\prime}) = (\mathbb R, \boldsymbol{ \mathfrak B}_\mathbb R).$
$\bullet$ Let $(\Omega, \boldsymbol{ \mathfrak A}, \mathbf P)$ be the probability space. Distribution of $X$ is the image measure of $\mathbf P$ under $X,$ that is, $\mathbf P_X:= \mathbf P\circ X^{-1}.$
$\bullet$ $X$ is continuous if $\mathbf P_X$ is absolutely continuous. For example, let $X$ be a real random variable. It is normal if $\mathbf P_X:= \mathcal N_{\mu,\sigma^2} =  f\boldsymbol\lambda$ where $f(x) = (\sqrt{2\pi\sigma^2})^{-1}\exp\left[-{(x-\mu)^2}/{2\sigma^2}\right]$ and $\boldsymbol\lambda$ is Lebesgue measure on $\mathbb R.$
Now, we are not interested with the underlying probability space  $(\Omega, \boldsymbol{ \mathfrak A}, \mathbf P):$

Events of $\Omega$ are not observed directly. Rather, the observations are aspects of the single experiments that are coded as measurable maps from $\Omega$  to a set of possible observations.

Probabilities of those observations are measured by the image measure $\mathbf P_X;$ it is of vital interest. It determines whether $X$ is of continuous type. What happens to $\omega \mapsto \omega^\prime$ is not the question we bother with.

Reference:
$\rm [I]$ Probability Theory: A Comprehensive Course, Achim Klenke, Springer, $2020,$ sec. $1.5,$ pp. $45-50.$
