Bases on your first question and the given code snippet above (better is to show us a complete short tex code building your bibliography and TOC so we do not have to guess what you are doing ...) first a solution for KOMA-Script only. Please see that I added option bibliography=totoc,
for class scrreprt
(needed for chapters or scrbook
):
\RequirePackage{filecontents}
\begin{filecontents}{\jobname.bib}
@Book{Goossens,
author = {Goossens, Michel and Mittelbach, Frank and
Samarin, Alexander},
title = {The LaTeX Companion},
edition = {1},
publisher = {Addison-Wesley},
location = {Reading, Mass.},
year = {1994},
}
@Book{adams,
title = {The Restaurant at the End of the Universe},
author = {Douglas Adams},
series = {The Hitchhiker's Guide to the Galaxy},
publisher = {Pan Macmillan},
year = {1980},
}
\end{filecontents}
\documentclass[%
fontsize=12pt,
titlepage,
paper=a4,
twoside,
bibliography=totoc, % <===============================================
]{scrreprt}
\usepackage{xurl}
\usepackage{scrlayer-scrpage}
\automark{chapter}
\clearpairofpagestyles
\setkomafont{pagehead}{\small\upshape}
\ohead{\rightmark}
\cfoot*{\pagemark}
\renewcommand*\chaptermarkformat{}
\begin{document}
\tableofcontents % <====================================================
\chapter{Chapter one}
\section{Section one}
\cite{Goossens} and \cite{adams}.
\urlstyle{same}
\bibliographystyle{plain} % <===========================================
\bibliography{\jobname} % <=============================================
\end{document}
and its result:

Please see that the Bibliography is added to the TOC in chapter style (red arrows; compare with Chapter one
above).
In your first question you are using apacite
. Please note that you have to add option [nosectionbib]
to the call of apacite
to get the bibliography in TOC in chapter style:
\usepackage[nosectionbib]{apacite} % <=================================
Please see the following complete mwe
\RequirePackage{filecontents}
\begin{filecontents}{\jobname.bib}
@Book{Goossens,
author = {Goossens, Michel and Mittelbach, Frank and
Samarin, Alexander},
title = {The LaTeX Companion},
edition = {1},
publisher = {Addison-Wesley},
location = {Reading, Mass.},
year = {1994},
}
@Book{adams,
title = {The Restaurant at the End of the Universe},
author = {Douglas Adams},
series = {The Hitchhiker's Guide to the Galaxy},
publisher = {Pan Macmillan},
year = {1980},
}
\end{filecontents}
\documentclass[%
fontsize=12pt,
titlepage,
paper=a4,
twoside,
bibliography=totoc, % <===============================================
]{scrreprt}
\usepackage[nosectionbib]{apacite} % <=================================
\bibliographystyle{apacite}
\usepackage{xurl}
\usepackage{scrlayer-scrpage}
\automark{chapter}
\clearpairofpagestyles
\setkomafont{pagehead}{\small\upshape}
\ohead{\rightmark}
\cfoot*{\pagemark}
\renewcommand*\chaptermarkformat{}
\begin{document}
\tableofcontents
\chapter{Chapter one}
\section{Section one}
\cite{Goossens} and \cite{adams}.
\urlstyle{same}
\bibliography{\jobname} % <=============================================
\end{document}
and its result:
