It is easy to add this case but I am afraid that there are more, and of course there is the problem that the user could enter conflicting information.
```
\documentclass[12pt]{standalone}
\usepackage{tikz}
\usepackage{amsmath}
\usetikzlibrary{patterns.meta}
\makeatletter
\tikzset{pics/interval/.style={code={%
\def\pv##1{\pgfkeysvalueof{/tikz/interval/##1}}%
\tikzset{interval/.cd,#1}%
\iftikzintervalscaled
\pgfmathsetmacro{\myintervalscale}{\pv{width}/(\pv{xmax}-\pv{xmin})/1cm}%
\else
\pgfmathsetmacro{\myintervalscale}{1}%
\fi
\pgfmathsetmacro{\xmid}{\pv{xmax}/2+\pv{xmin}/2}%
\begin{scope}[xscale=\myintervalscale,shift={(-\xmid,0)}]
\draw[interval/axis] (\pv{xmin},0) -- (\pv{xmax},0);
\pgfmathtruncatemacro{\itest}{(\pv{xmin}<\pv{imin})}%
\ifnum\itest=1
\path[interval/excluded]
(\pv{xmin},-\pv{h}/2) rectangle (\pv{imin},\pv{h}/2);
\path ([xshift=0.2ex/\myintervalscale]\pv{imin},0) node {$\pv{left}$}
node[interval/both labels,interval/left
label]{$\pgfmathparse{\pv{l}}\pgfmathprintnumber\pgfmathresult$};
\fi
\pgfmathtruncatemacro{\itest}{(\pv{xmax}>\pv{imax})}%
\ifnum\itest=1
\path[interval/excluded]
(\pv{imax},-\pv{h}/2) rectangle ([xshift=-1em/\myintervalscale]\pv{xmax},\pv{h}/2);
\path ([xshift=-0.2ex/\myintervalscale]\pv{imax},0) node {$\pv{right}$}
node[interval/both labels,interval/right label]{$\pgfmathparse{\pv{r}}\pgfmathprintnumber\pgfmathresult$};
\fi
\pgfmathtruncatemacro{\itest}{(\pv{xmax}<\pv{imax}&&\pv{xmin}>\pv{imin})}%
\ifnum\itest=1
\path[interval/excluded]
(\pv{xmin},-\pv{h}/2) rectangle (\pv{xmax},\pv{h}/2);
\fi
\end{scope}
}},
interval/.cd,axis domain/.code args={#1:#2}{%
\tikzset{interval/.cd,xmin=#1,xmax=#2}%
},interval domain/.code args={#1:#2}{%
\tikzset{interval/.cd,imin=#1,imax=#2}%
},xmin/.initial=-5,xmax/.initial=5,
imin/.initial=0,imax/.initial=1,
left/.initial={(},right/.initial={)},
scaled/.is if=tikzintervalscaled,scaled/.default=true,
width/.initial=8cm,h/.initial=9pt,
axis/.style={thick,-stealth},
excluded/.style={pattern={Lines[angle=45,distance={2pt}]}},
both labels/.style={below,text=blue,text height=1.2em},
left label/.style={},right label/.style={},
l/.initial={\pv{imin}},r/.initial={\pv{imax}},
intersection of/.code args={#1 and #2}{%
\expanded{\noexpand\pgfutil@in@{[}{#1}}% test if [ is contained in #1
\ifpgfutil@in@%
\edef\pgf@util@tmpc{1}%
\else
\edef\pgf@util@tmpc{0}%
\fi
\expanded{\noexpand\pgfutil@in@{]}{#1}}% test if [ is contained in #1
\ifpgfutil@in@%
\edef\pgf@util@tmpc{\the\numexpr\pgf@util@tmpc+2}%
\fi
\ifcase\pgf@util@tmpc
\def\pgf@util@tmpp(##1,##2);{\pgfmathsetmacro\pgf@util@tmpa{##1}\pgfmathsetmacro\pgf@util@tmpb{##2}}%
\expandafter\pgf@util@tmpp#1;
\or
\def\pgf@util@tmpp[##1,##2);{\pgfmathsetmacro\pgf@util@tmpa{##1}\pgfmathsetmacro\pgf@util@tmpb{##2}}%
\expandafter\pgf@util@tmpp#1;
\or
\def\pgf@util@tmpp(##1,##2];{\pgfmathsetmacro\pgf@util@tmpa{##1}\pgfmathsetmacro\pgf@util@tmpb{##2}}%
\expandafter\pgf@util@tmpp#1;
\or
\def\pgf@util@tmpp[##1,##2];{\pgfmathsetmacro\pgf@util@tmpa{##1}\pgfmathsetmacro\pgf@util@tmpb{##2}}%
\expandafter\pgf@util@tmpp#1;
\fi
%
\expanded{\noexpand\pgfutil@in@{[}{#2}}% test if [ is contained in #1
\ifpgfutil@in@%
\edef\pgf@util@tmpc{1}%
\else
\edef\pgf@util@tmpc{0}%
\fi
\expanded{\noexpand\pgfutil@in@{]}{#2}}% test if [ is contained in #1
\ifpgfutil@in@%
\edef\pgf@util@tmpc{\the\numexpr\pgf@util@tmpc+2}%
\fi
\ifcase\pgf@util@tmpc
\def\pgf@util@tmpp(##1,##2);{\pgfmathsetmacro\pgf@util@tmpx{##1}\pgfmathsetmacro\pgf@util@tmpy{##2}}%
\expandafter\pgf@util@tmpp#2;
\or
\def\pgf@util@tmpp[##1,##2);{\pgfmathsetmacro\pgf@util@tmpx{##1}\pgfmathsetmacro\pgf@util@tmpy{##2}}%
\expandafter\pgf@util@tmpp#2;
\or
\def\pgf@util@tmpp(##1,##2];{\pgfmathsetmacro\pgf@util@tmpx{##1}\pgfmathsetmacro\pgf@util@tmpy{##2}}%
\expandafter\pgf@util@tmpp#2;
\or
\def\pgf@util@tmpp[##1,##2];{\pgfmathsetmacro\pgf@util@tmpx{##1}\pgfmathsetmacro\pgf@util@tmpy{##2}}%
\expandafter\pgf@util@tmpp#2;
\fi
\pgfmathtruncatemacro\pgf@util@tmpi{(min(\pgf@util@tmpb,\pgf@util@tmpy)>max(\pgf@util@tmpa,\pgf@util@tmpx)?1:0)}%
\ifnum\pgf@util@tmpi=0\relax
\typeout{The intersection between #1 and #2 is empty.}%
\tikzset{interval/.cd,imin/.evaluated=\pgfkeysvalueof{/tikz/interval/xmin}-0.1,
imax/.evaluated=\pgfkeysvalueof{/tikz/interval/xmax}+0.1}%
\else
\pgfmathsetmacro{\pgf@util@tmpd}{max(\pgf@util@tmpa,\pgf@util@tmpx)}%
\pgfmathsetmacro{\pgf@util@tmpe}{min(\pgf@util@tmpb,\pgf@util@tmpy)}%
\tikzset{interval/.cd,imin=\pgf@util@tmpd,imax=\pgf@util@tmpe}%
\fi}}
\newif\iftikzintervalscaled
\tikzintervalscaledtrue
\makeatother
\begin{document}
\begin{tikzpicture}
\path (0,0) pic{interval={axis domain=-5:5,%interval domain=-2:2,
intersection of={(-4, -3) and [-3,1]}}};
\end{tikzpicture}
\end{document}
```