Let $D$ be a subset of $\mathbb{R}^n$ and $\Omega$ be a compact subset of $\mathbb{R}^m$; $\;f: D \times \Omega \to \mathbb{R}$ be a continuous function. Define $M(x) \subseteq \Omega$ as \begin{equation} M(x) := \{ y \in \Omega: f(x,z) \leq f(x,y) \textrm{ for all } z \in \Omega \}, \end{equation} which can be considered as the "argmax" operator on $f$ over $\Omega$. Then, $M(x)$ is not empty since for every $x \in D$, $f(x, \cdot)$ has its maximum (and of course its minimum) over the compact set $\Omega$. Let $g: D \to \Omega$ be any function satisfying \begin{equation} g(x) \in M(x). \end{equation} and suppose that $M(x)$ is a singleton for all $x \in D$, so that $g(x)$ is uniquely defined. Then, my questions can be summarized as follows.
(Continuity of $g(x)$) Can we conclude that $g$ is continuous? If not, what's the additional condition(s) on $f$ (or its domain $D$) to hold continuity of $g$?
(Lipschitz Continuity of $g(x)$) Is $g$ is Lipschitz continuous when so is $f$?$-$here, Lipscthiz continuity on $f$ means that there is $L > 0$ such that \begin{equation} \big | \, f(x_1,y_1) - f(x_2,y_2) \big | \leq L \, \big \|(x_1,y_1) - (x_2,y_2) \big \| \;\;\;\, \forall (x_1, y_1), \, (x_2, y_2) \in D \times \Omega, \end{equation} where $\| \cdot \|$ is any norm on $\mathbb{R}^n \times \mathbb{R}^m$.
What happens if $M(x)$ is not a singleton, but contains at least two elements for some or all $x \in D$?
I think the statements do not hold in general, but I fail to give a counter-example or prove that it's true. I also found some discussions on the continuity of $h(x) := \max_{y \in \Omega} f(x,y)$, e.g.,
Is supremum over a compact domain of separately continuous function continuous?
How prove this $g(x)=\sup{\{f(x,y)|0\le y\le 1\}}$ is continuous on $[0,1]$
However, those cases do not discuss about the continuity of $g$ constructed by "argmax", rather than "sup" or "max."
Many thanks in advance.