You did not specify what behavior you wish to have if things are wrapped in \MakeUppercase/\MakeLowercase/\uppercase/\lowercase.
If you are not comfortable with temporary macros and \ifx..\else..\fi for whatsoever reason and like "oldschool-coding", then you can, e.g., do this fully expandable by means of delimited arguments.
\makeatletter
%%=============================================================================
%% Paraphernalia:
%% \UD@firstoftwo, \UD@secondoftwo, \UD@CheckWhetherNull,
%% \UD@CheckWhetherBlank
%%=============================================================================
\newcommand\UD@firstoftwo[2]{#1}%
\newcommand\UD@secondoftwo[2]{#2}%
\@ifdefinable\UD@stopromannumeral{\chardef\UD@stopromannumeral=`\^^00}%
%%-----------------------------------------------------------------------------
%% Check whether argument is empty:
%%.............................................................................
%% \UD@CheckWhetherNull{<Argument which is to be checked>}%
%% {<Tokens to be delivered in case that argument
%% which is to be checked is empty>}%
%% {<Tokens to be delivered in case that argument
%% which is to be checked is not empty>}%
%%
%% The gist of this macro comes from Robert R. Schneck's \ifempty-macro:
%% <https://groups.google.com/forum/#!original/comp.text.tex/kuOEIQIrElc/lUg37FmhA74J>
\newcommand\UD@CheckWhetherNull[1]{%
\romannumeral\expandafter\UD@secondoftwo\string{\expandafter
\UD@secondoftwo\expandafter{\expandafter{\string#1}\expandafter
\UD@secondoftwo\string}\expandafter\UD@firstoftwo\expandafter{\expandafter
\UD@secondoftwo\string}\expandafter\UD@stopromannumeral\UD@secondoftwo}{%
\expandafter\UD@stopromannumeral\UD@firstoftwo}%
}%
%%-----------------------------------------------------------------------------
%% Check whether argument is blank, i.e., is empty or consists of space tokens
%% only:
%%.............................................................................
%% -- Take advantage of the fact that TeX discards space tokens when
%% "fetching" _un_delimited arguments: --
%% \UD@CheckWhetherBlank{<Argument which is to be checked>}%
%% {<Tokens to be delivered in case that
%% argument which is to be checked is blank>}%
%% {<Tokens to be delivered in case that argument
%% which is to be checked is not blank>}%
\newcommand\UD@CheckWhetherBlank[1]{%
\romannumeral\expandafter\expandafter\expandafter\UD@secondoftwo
\expandafter\UD@CheckWhetherNull\expandafter{\UD@firstoftwo#1{}{}}%
}%
%%=============================================================================
\@ifdefinable\UD@GobbleToExclam{\long\def\UD@GobbleToExclam#1!{}}%
%
\newcommand\myalert[1]{%
\UD@CheckWhetherBlank{#1}{% #1 is blank, i.e., either empty or space tokens only
}{% #1 is not blank
\expandafter\UD@CheckWhetherNull\expandafter{\UD@GobbleToExclam#1!}{%
\ForkNoalertNullElse
!#1!null!{}% #1 = noalert
!noalert!#1!{}% #1 = null
!noalert!null!{\textcolor{red}{ALERT: #1}}% #1 s. th. else withhout !
!!!!%
}{\textcolor{red}{ALERT: #1}}% #1 s. th. else with !
}%
}%
\@ifdefinable\ForkNoalertNullElse{\long\def\ForkNoalertNullElse#1!noalert!null!#2#3!!!!{#2}}%
\makeatother
\documentclass{article}
\usepackage{xcolor}
\colorlet{RED}{red}
\begin{document}
\begin{tabular}{ll}
\textbf{Command}&\textbf{Result}\
\hline
\verb|(\myalert{Some text})|&(\myalert{Some text})\
\verb|(\myalert{Some ! text})|&(\myalert{Some ! text})\
\verb|(\myalert{Some {more} text})|&(\myalert{Some {more} text})\
\verb|(\myalert{})|&(\myalert{})\
\verb|(\myalert{ })|&(\myalert{ })\
\verb|(\myalert{noalert})|&(\myalert{noalert})\
\verb|(\myalert{null})|&(\myalert{null})\
\verb|\MakeUppercase{(\myalert{Some text})}|&\MakeUppercase{(\myalert{Some text})}\
\verb|\MakeUppercase{(\myalert{null})}|&\MakeUppercase{(\myalert{null})}\
\verb|\uppercase{(\myalert{Some text})}|&\uppercase{(\myalert{Some text})}\
\verb|\uppercase{(\myalert{null})}|&\uppercase{(\myalert{null})}
\end{tabular}
\end{document}

Notice the behavior when things are wrapped in \uppercase:
Uppercasing null yields NULL which is not the same as null, thus an alert-message with NULL as its argument is delivered.
ifthen, or did I understand you wrong? – Oleg Lobachev Jul 20 '22 at 15:23\myalertto gobble its argument. – Ulrike Fischer Jul 20 '22 at 15:28