Preface
("What isn't my question")
As prominently articulated by Mill, liberalism (and the harm principle) asserts that it is always bad for aggregate utility to coercively interfere in people's voluntary, self-regarding actions. As Mill did not obviously define what is self-regarding ("harmful"), there are various interpretations. For instance Rees (1960) suggested that Mill limited harm to the violation of rights that people ought to have. I'm personally not convinced that Mill's distinction between "offence" and "harm" was some arbitrary list of rights, as he explicitly defined "interest" in Utilitarianism as simply utility:
[...] the happiness, or (as speaking practically it may be called) the interest, of every individual, as nearly as possible in harmony with the interest of the whole
Question
The point being assessments of harm are always comparative - to some baseline. In utilitarian ethics, "good"/"bad", "beneficial"/"harmful" semantically denote the utility of an action relative to another, whether explicitly stated or implied. One might say that it is good to adopt and travel by electric vehicles, relative to continuing to use internal combustion engines (for it may not be good compared to reducing private vehicle transport altogether and moving to other transport modes). So when referring to an action as "harmful", one is necessarily comparing it to another action with a higher utility. This raises the question of the right baseline to use when assessing "harm" in the context of the harm principle.
Using the example of "duty to rescue" laws, it seems logical that Mill would not compare an action to merely if nothing was done when assessing its harmfulness, for it would justify the absolute liberty to walk past someone suffering a cardiac arrest without helping, and render such laws illegitimate. I.e. If we define the baseline as merely doing nothing, liberalism would contradict with utilitarianism in situations where an action is equivalent to, or better than doing nothing, and there exists an even better course of action.
To reconcile with such scenarios, I have come to regard "self-regarding" as not negatively affecting the aggregate utility of others, compared to all other available courses of action in a given scenario (not worse than any other option). This clearly restricts liberalism's domain of application; but broadly defining "self-regarding" seems to make liberalism and utilitarianism contradict. Rather than flawed applications of liberalism, I think direct utilitarian reasoning better handles complex ethical questions where there aren't multiple, equally consequential options, all of which are equally best.
Edit: The SEP resembles my interpretation of Mill's conceptualisation - In discussing enforceable duties to give evidence or Samaritan aid, Mill claims that the failure to confer benefits constitutes harm.
Related question (doesn't address the harm principle): Is it OK to be indifferent or inactive when another is being harmed? Edit: I didn't use the right keywords. Found this when searching "harm principle baseline" - https://link.springer.com/article/10.1007/s11158-013-9235-5. Will add more info after I read it