Below is the code I have currently and the output which it brings, but I was wondering if there was a way to get the section title to show in the same way without having to type it in /rhead for every section?

\documentclass[a4paper, 12pt, fleqn]{article}
\usepackage{fancyhdr}
\titleformat{\section}[display]{\centering\Large\bfseries}{}{0pt}{\underline} \sectionfont{\centering}
\pagestyle{fancy}
\fancyhf{}
\rfoot{Page \thepage \hspace{1pt} of \pageref{LastPage}}
\section{Unit 1: Algebra}

• You could switch to report or book class and use \chapter. – John Kormylo Jan 12 at 15:01
• You speak about chapters but you are using the article class, which does not provide the \chapter command. The code you make available lacks some packages and it does not compile at all. You should provide a minimal working example. However I will try to give you an answer. – Ivan Jan 12 at 15:06

As you load titlesec, I would use \titleps via the [pagestyles] option, which has a \sectiontitle command. Here is a code for a two-sided layout:

\documentclass[a4paper, twoside, 12pt, fleqn]{article}
\usepackage{lastpage}
\usepackage[pagestyles]{titlesec} %
\titleformat{\section}[display]{\centering\Large\bfseries}{}{0pt}{\underline}
\usepackage{lipsum}

\setfoot[Page \thepage \hspace{1pt} of \pageref{LastPage}][][]{}{}{Page \thepage \hspace{1pt} of \pageref{LastPage}}
}
\pagestyle{own}

\begin{document}

\section{Unit 1: Algebra}
\lipsum[1-20]

\end{document}


To get the right headers you have to use the correct marks. In your case \leftmark should respond to your need:

\documentclass[a4paper, 12pt, fleqn]{article}
\usepackage{fancyhdr}
\usepackage{titlesec}
\usepackage{lastpage}
\usepackage{lipsum}
\titleformat{\section}[display]
{\centering\Large\bfseries}
{Unit \thesection}
{0pt}
{}

\pagestyle{fancy}
\fancyhf{}