To put it most simply, I am trying to replicate this answer, except for the \section command not \subsection
There are other answers on custom sections and table of contents such as this question, however this method has shortcoming such as non-automatic spacing in the table of contents, referencing by label doesn't work right, and also it doesn't get the subsection numbering to follow your convention automatically.
Here is some code demonstrating these shortcomings:
\documentclass{memoir}
%for this example, need to be able to show subsubsections
\setsecnumdepth{subsubsection}
\maxtocdepth{subsubsection}
\usepackage{hyperref}
%% This is the custom 'section' command from the question I reference
\makeatletter
\newcommand@csection{@startsection {section}{1}{\z@}%
{-3.5ex @plus -1ex @minus -.2ex}%
{2.3ex @plus.2ex}%
{\normalfont\Large\bfseries}}
\newcommand{\csection}[1]{%
@csection*{#1}%
\addcontentsline{toc}{section}{#1}%
}
\makeatother
%% This is the custom 'SUBsection' command from the answer I reference
\NewCommandCopy{\originalsubsection}{\subsection} %\LetLtxMacro{\originalsubsection}{\subsection}
\RenewDocumentCommand{\subsection}{s d() o m}{%
\IfBooleanTF{#1}
{\originalsubsection*{#4}}%
{%
\IfValueTF{#2}
{% letter
\addtocounter{subsection}{-1}%
\renewcommand{\thesubsection}{\thesection.#2}%
}
{% no letter
\renewcommand{\thesubsection}{\thesection.\arabic{subsection}}%
}%
\originalsubsection[\IfValueTF{#3}{#3}{#4}]{#4}%
}%
}
\renewcommand{\theHsubsection}{\thesubsection}
\begin{document}
\tableofcontents
\chapter{First Chapter}
\section{First section}
\subsection{normal subsection}
\subsection(P){custom subsection}\label{v}
\subsubsection{First subsubsection}\label{1-v}
\csection{1.A Custom section}
\csection{1.B \hspace{1ex} Custom section}\label{vA}
\subsection{First subsection}\label{1-vA}
\ref{v} and \ref{1-v} vs. \ref{vA} and \ref{1-vA}
\end{document}

\numberline{...}as in\addcontentsline{toc}{section}{\string\numberline{1.A}Custom section}– John Kormylo May 20 '23 at 03:29