Indeed, I think that the statement in Tong's book is quite ambiguous (though it is not definitely false as I discuss below). In principle there is no relation between the possibility of a  Hamiltonian formulation and  conservation of energy. A harmonic oscillator with potential $k(t)x^2/2$ admits Hamiltonian formulation even if $k$ depends on time and thus energy is not conserved.
Physically speaking this system can be obtained by continuously heating the spring of the oscillator, i.e., continuously adding external energy to the system. That is the reason why it is not conserved. However there is a Hamiltonian function, the usual one
$p^2/2m + k(t)x^2/2$, which produces the right equations of motion.
Another example is a material point constrained to stay on a frictionless axis $x$. This axis rotates around the origin $O$ with constant angular velocity $\Omega$ in a inertial reference frame. The material point does not conserve its energy in the inertial reference frame, because energy must be continuously added to preserve the rotation, but the system admits a Hamiltonian formulation with hamiltonian
$H= p^2/2m - m\Omega^2 x^2/2$.
What it is true is that the Hamiltonian formulation is not possible when there are physical forces whose Lagrangian components would change the volume of the space of  the phases during the evolution of the system, thus violating the Liouville theorem. That is the case of dissipative forces. (There is an exception for one-dimensional systems pointed out by @Qmechanic's answer, second point, obtained by exploiting an unconventional approach.) These forces are also an obstruction to energy conservation. I think the book intended just  to  remark this fact by using that "roughly speaking".
However, for macroscopic systems, energy is not conserved also because of a time dependence of some macroscopic parameter describing the system or due to the nature of the constraints. In these cases a Hamiltonian formulation may be still possible.