Although @tarlebs's answer is certainly the best (except that it indicates the wrong amount of vertical space), here it is "simpler" (in some respects) but a more hacky (at least in LaTeX terms) solution that additionally uses the Pandoc filter Lua or LaTeX hack, but avoids downloading another LaTeX package.
We want the LaTeX source to look something like this:
\hypertarget{level-4-heading}{% \paragraph{Level 4 heading}\label{level-4-heading}} \hfill Lorem ipsum dolor sit amet.
This LaTeX looks awful, but if you do not need to save or share the LaTeX source, it does what you probably want: the space between the level 4 heading and the paragraph after it are equal to the gap between the level 3 heading and the paragraph after it.

Here's how it works: since \hfill about to close on a separate line, how can you get to an empty paragraph in LaTeX you will get the first paragraph - the one that comes with the heading - containing only a horizontal space to the end of the line, and then immediately after the new paragraph - the actual first paragraph after the heading is just a normal paragraph between it and the heading. This one probably also upsets LaTeXs idea of ​​how small \paragraph should be.
The manual way to do this is as follows:
#
It uses a relatively new syntax for raw Pandocs markup - “code block”. this is actually a raw LaTeX block - but it looks even worse than the resulting LaTeX source! It is also a tedious routine to insert this after each level 4 header. In other words, you want to insert this Raw LaTeX automatically, and this can be done using the Lua filter:
--[======================================================================[ latex-h4-break.lua - Pandoc filter to get break after a level 4 heading. Usage: $ pandoc --lua-filter latex-h4-break.lua input.md -o output.pdf --]======================================================================] -- create it once, use it many times! local hfill_block = pandoc.RawBlock('latex', '\\hfill') function Header (elem) if 4 == elem.level then return { elem, hfill_block } else -- ignore headings at other levels! return nil end end
However, you can also do a simple LaTeX hack in the header-includes Metadata block to get the same effect:
--- header-includes: - | ''' {=latex} \let\originAlParaGraph\paragraph \renewcommand{\paragraph}[1]{\originAlParaGraph{#1} \hfill} ''' ---
This works by first creating an alias of the \paragraph command and then redefining the \paragraph command itself using the alias in the new definition, so now wherever the LaTeX source is created, Pandoc contains \paragraph{Foo} if it instead contains \paragraph{Foo} \hfill that does what we want with zero dependency gain! (In case you are interested in the strange spelling of an “alias”, the Team minimizes the risk that it runs into something that already exists, since the TeX \let command does not verify this. We certainly do not want to overwrite any existing command !)
NOTE. If you really need more or less space than usual To break a paragraph after the heading, just add the appropriate \vspace command after \hfill : \hfill \vspace{-0.5\parskip} .