Regarding the command below, it creates a box around the designated letter (B) with colored background (Light gray) and does not affect the inter-character spacing of the word:
\uline{\adjustbox{cframe=black 0.1mm 2pt 0mm,bgcolor=gray!25}{{\textbf{B}}}}ob
I need to have exactly the same result but with a dotted box instead, so I tried the dashbox package, yet I cannot set the dimensions as shown above and also I cannot set the background color, intercharacter spacing, box size and background color cannot be set
\uline{\textbf{\dbox{B}}}ob
\documentclass[a4paper,12pt,twoside]{book}
\usepackage{dashbox}
\usepackage[normalem]{ulem}
\usepackage{adjustbox}
\usepackage[bidi=basic,layout=lists.tabular]{babel}
\babelprovide[import=ar,mapdigits,main]{arabic}
\babelprovide[import=en,language=Default]{english}
\babelfont[arabic]{rm}{Simplified Arabic}
\babelfont[english]{rm}{Times New Roman}
\begin{document}
\uline{\textbf{\dbox{B}}}ob
\uline{\adjustbox{cframe=black 0.1mm 2pt 0mm,bgcolor=gray!25}{{\textbf{B}}}}ob
\end{document}