Let $f:[2,0)\cup(0,2]$ be defined by $f(x)=|x|$. Then $f$ is differentiable with $f'(x)=-1$ for $x<0$ and $f'(x)=1$ for $x>0$. Therefore $f$ is decreasing on $[-2,0)$ and so attains a maximum value of $2$ at $x=-2$. Similarly, $f$ is increasing on $(0,2]$ and so attains a maximum value of $2$ at $x=2$.
Let $g(x)=1$ for $x=0$ and let $F(x) = f(x)+g(x)$. Then there exists the neighborhood $(-1/2,1/2)$ of $0$ on which $F(x)
Since $F(x)\leqslant 2$ for all $x\in[-2,2]$, it follows that $F$ attains its global maximum of $2$ at both $x=-2$ and $x=2$.