This is a pure calc alternative in case dimline doesn't allow you to do that. (I do not know what dimline does.) This is an updated answer in which I try to address your comments. It comes with a decoration indicate dimensions, which has one argument, the label. All distances and other parameters are stored in pgfkeys. Drawing the line plus all the dimension lines and perpendicular lines boils down to
\draw[postaction={indicate dimensions={label}}] (A)--(B);
Here is the code with many examples.
\documentclass[tikz, border=1cm]{standalone}
\usetikzlibrary{calc,decorations.pathreplacing,arrows.meta}
\newif\ifdrawdimlineleft
\newif\ifdrawdimlineright
\tikzset{dimlabel distance/.initial=5mm,
vertical lines extend/.initial=5mm,
vertical dim line/.style={gray,thin},
dim arrow line/.style={latex-latex,thin},
dim label/.style={},
left dimline/.is if=drawdimlineleft,
left dimline=true,
right dimline/.is if=drawdimlineright,
right dimline=true,
indicate dimensions/.style={decorate,decoration={
show path construction,
lineto code={
\draw[dim arrow line]
($ (\tikzinputsegmentfirst)!\pgfkeysvalueof{/tikz/dimlabel distance}!-90:(\tikzinputsegmentlast) $) -- ($ (\tikzinputsegmentlast)!\pgfkeysvalueof{/tikz/dimlabel distance}!90:(\tikzinputsegmentfirst) $)
\ifx#1\empty
\else
node[midway,sloped,fill=white,dim label]{#1}
\fi;
\ifdrawdimlineleft
\draw[vertical dim line] (\tikzinputsegmentfirst) --
($ (\tikzinputsegmentfirst)!\pgfkeysvalueof{/tikz/vertical lines
extend}!-90:(\tikzinputsegmentlast) $);
\fi
\ifdrawdimlineright
\draw[vertical dim line] (\tikzinputsegmentlast) --
($ (\tikzinputsegmentlast)!\pgfkeysvalueof{/tikz/vertical lines extend}!90:(\tikzinputsegmentfirst) $);
\fi
}}}}
\begin{document}
\begin{tikzpicture}[font=\sffamily,
plotmark/.style = {%
draw, fill=red, circle, inner sep=0pt, minimum size=4pt
}
]
\begin{scope}[local bounding box=basic]
\coordinate (A) at (0,0);
\coordinate (B) at (5,3);
\draw[postaction={indicate dimensions={label}}] (A)--(B);
\node[plotmark, label={above:$A$}] at (A) {};
\node[plotmark, label={above:$B$}] at (B) {};
\end{scope}
\node at (basic.north) {basic application};
%
\begin{scope}[xshift=6cm,local bounding box=no left]
\coordinate (A) at (0,0);
\coordinate (B) at (5,3);
\draw[postaction={indicate dimensions={label},left dimline=false}] (A)--(B);
\node[plotmark, label={above:$A$}] at (A) {};
\node[plotmark, label={above:$B$}] at (B) {};
\end{scope}
\node at (no left.north) {omit a vertical line};
%
\begin{scope}[yshift=-6cm,local bounding box=no label]
\coordinate (A) at (0,0);
\coordinate (B) at (5,3);
\draw[postaction={indicate dimensions=\empty}] (A)--(B);
\node[plotmark, label={above:$A$}] at (A) {};
\node[plotmark, label={above:$B$}] at (B) {};
\end{scope}
\node at (no label.north) {omit label};
%
\begin{scope}[xshift=6cm,yshift=-6cm,local bounding box=change arrow]
\coordinate (A) at (0,0);
\coordinate (B) at (5,3);
\draw[postaction={indicate dimensions={label},
dim arrow line/.style={Bar-Circle,thin}}] (A)--(B);
\node[plotmark, label={above:$A$}] at (A) {};
\node[plotmark, label={above:$B$}] at (B) {};
\end{scope}
\node at (change arrow.north) {change arrow appearance};
%
\begin{scope}[yshift=-12cm,local bounding box=no line]
\coordinate (A) at (0,0);
\coordinate (B) at (5,3);
\draw[postaction={indicate dimensions={label},dim arrow
line/.style={opacity=0},dim label/.style={opacity=1}}] (A)--(B);
\node[plotmark, label={above:$A$}] at (A) {};
\node[plotmark, label={above:$B$}] at (B) {};
\end{scope}
\node at (no line.north) {omit arrow};
%
\begin{scope}[xshift=6cm,yshift=-12cm,local bounding box=no slope]
\coordinate (A) at (0,0);
\coordinate (B) at (5,3);
\draw[postaction={indicate dimensions={label},
dim label/.style={sloped=false}}] (A)--(B);
\node[plotmark, label={above:$A$}] at (A) {};
\node[plotmark, label={above:$B$}] at (B) {};
\end{scope}
\node at (no slope.north) {don't slope the label};
\end{tikzpicture}
\end{document}

angleslibrary, which is described in detail in section 39 Angle Library of the pgfmanual. – Jan 01 '19 at 17:54\path[postaction={indicate dimensions={label},left dimline=false}] (A)--(B);, i.e.\pathinstead of\draw. BTW, I think I have an idea how to fix thedimension too largeerrors withxfp. Could you please indicate which codes have caused trouble? – Feb 08 '19 at 15:04