Currently, the Section header text indentation is hanged thanks to @Simon Dispa solution at Misalignment caused by hyphenat package and header text font settings. I also want to have my Chapter header text indentation be hanged just like that of the Section. Below is the MWE:
\documentclass[12pt,openany,twoside]{book}
\raggedbottom
\usepackage[
left=2.5cm,
right=2.5cm,
top=3cm,
bottom=3cm,
headheight = 3\baselineskip,
headsep = 5mm,
a4paper
]{geometry}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage[table]{xcolor}
\usepackage{graphicx}
\newcommand\HRule{\noindent\rule{\linewidth}{1.5pt}}
\usepackage{background}
\backgroundsetup{contents={}}
\usepackage{fancyhdr}
\usepackage{hhline}
\newcommand*\myheaderfooterfont{\normalfont\bfseries\selectfont}
\newlength{\leftspace}%
\setlength{\leftspace}{18ex}%
\newlength{\xindent}
\settowidth{\xindent}{\myheaderfooterfont\thechapter.\thesection\:}
\usepackage{varwidth}%
\fancypagestyle{fancy}{%
\fancyhf{}
\fancyhead[OL]{\leftmark}
\fancyhead[ER]{\begin{varwidth}{\dimexpr\textwidth-\leftspace}\myheaderfooterfont\raggedright\parindent-\xindent\rightmark\end{varwidth}}
\fancyfoot{}
\fancyfoot[RE,RO]{\thepage}
\renewcommand\headrule
{{ \color{blue}\rule{1\headwidth}{2.5pt}%
}}
}
\fancypagestyle{plain}{%
\fancyhf{}%
\renewcommand\headrule
{{ \color{blue}\rule{1\headwidth}{0pt}%
}}
}
\pagestyle{fancy}
\usepackage{showframe}
\usepackage[none]{hyphenat}
\raggedright
\begin{document}
%<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<added
\frontmatter
\chapter*{ABC}
\markboth{ABC}{ABC}
eeeheeyeyeyeyeyeeyeye
\section*{DEG}
dddheheheheheheheehehehe
\pagebreak
\section*{KJ}
ddhheheheheheehehehheheheheheh
\pagebreak
\section*{KDH}
dhddhhehehehehehehehehehehe
\mainmatter
%<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<added
\chapter{ABCD ffhfgrhr ejejejeje fhfhfhf ehehehehe dhddhdhellgl rkttkgkhihi eeeejejwnwn hhlhlnnmgjgj rjrrjoaoaoao rjjrjrrrj wwjwwwjwjw}
eehehdhdhdhdddddd ddddddddddddddddddddd
\pagebreak
\section{Special keyboard characters gghthr rhrrhd fheheh fhehuw fhewiwi feiwiwd fiiwiwid fiiwiwi firiifn rokfkkvfvv fjjjeje jejeje djej}
\LaTeX{} has many symbols at its disposal. The majority of them are within the mathematical domain as shown in \eqref{eq:1} and \eqref{eq:2}. The ten special keyboard characters are: \verb|#|, \verb|$|, \verb|%|, \verb|&|, \verb|~|, \verb|_|, \verb|^|, \verb|\| and \verb|{}|. If you simply want the character to be printed just as any other letter, include a \verb|\ | in front of the character. For example, \verb|\$| will produce \verb|$| in your output.
The exception to the rule is the \verb|\ | itself because \verb|\\ | has its own special meaning. A \verb|\ | is produced by typing \verb|$\backslash$| in your file.
\clearpage
Special keyboard characters dhgdgdg dgdgdgdg ggdgdgd egegegege dgddgdgd eggegegeg dgdgdgdgd egegegeg dggeieieirr tktii43iwje rfrhrhrhr gtktotyiyighgjgj fkf
Some text.
\end{document}