Suppose we have two particles [...] How should they instead accelerate to have the distance Lorentz-contract?
A solution is arguably described in J. Franklin, "Rigid body motion in special relativity" (arxiv.org/abs/1105.3899).
Using the notation from the question above: Given the trajectory, wrt. the (inertial) "laboratory frame", of "particle $2$" as
$$x_2[ t ] := \frac{c^2}{w} \left( \sqrt{1 + \frac{w^2~t^2}{c^2}} - 1\right) + x_2[ 0 ],$$
i.e. uniform acceleration of "particle $2$" with proper acceleration $ w $,
and provided that
$$0 \lt x_2[ 0 ] - x_1[ 0 ] \lt \frac{c^2}{w},$$
set the trajectory of "particle $1$" to
$$x_1[ t ] := \left( \frac{c^2}{w} + x_1[ 0 ] - x_2[ 0 ] \right) ~ \left( \sqrt{1 + \frac{w^2~t^2~c^2}{(c^2 + (x_1[ 0 ] - x_2[ 0 ]) ~w)^2}} - 1\right) + x_1[ 0 ],$$
i.e. uniform acceleration of "particle $1$" with proper acceleration $ w ~ \frac{c^2}{c^2 + (x_1[ 0 ] - x_2[ 0 ]) ~w}$.
Then it can be shown that a "family of momentarily co-moving pairs", $\{ (A_t, B_t) \}$, can be considered (or even be found) such that
(a)
for any parameter value $t \ge 0$ the pair $(A_t, B_t)$ is at rest to each other,
(b)
with distances between any such pair equal to each other:
$AB_t = AB_0 := x_2[ 0 ] - x_1[ 0 ]$
(c)
the speed of pair $(A_t, B_t)$ wrt. the (inertial) "laboratory frame" is $\frac{w~t}{ \sqrt{1 + \frac{w^2~t^2}{c^2}} },$
(d)
particle $1$ met $A_t$ as it "turned around" wrt. pair $(A_t, B_t)$ (i.e. after "having approached $A_t$ from the direction of $B_t$", and before "going to further separate from $A_t$ towards $B_t$"),
(e)
particle $2$ met $B_t$ as it "turned around" wrt. pair $(A_t, B_t)$ (i.e. after "having approached $B_t$ from the direction opposite of $A_t$", and before "going to further separate from $B_t$ in the direction opposite of $A_t$"), and
(f)
$A_t$'s indication of having met particle $1$ and $B_t$'s indication of having met particle $2$ were simultaneous to each other.
Since the distance between any pair of members of the (inertial) "laboratory frame" whose indications of "having been met and passed by $A_t$" and "having been met and passed by $B_t$", respectively, were simultaneous to each other is
$$ \frac{x_2[ 0 ] - x_1[ 0 ]}{ \sqrt{1 + \frac{w^2~t^2}{c^2}} } = (x_2[ 0 ] - x_1[ 0 ]) ~ \sqrt{1 - \left( \frac{w~t}{ \sqrt{1 + \frac{w^2~t^2}{c^2}} } ~\frac{1}{c}\right)^2}, $$
where the right-hand-side is stated in terms of the speed value which appears in (c)
,
there applies the familiar "length-contraction" relation at least between the (inertial) "laboratory frame" and each "momentarily co-moving pair, $(A_t, B_t)$".
However, obviously, since with the described "solution" particle $1$ and particle $2$ are not at rest to each other, there is no value of "distance between them" defined to begin with. Indeed, not even the ping durations of either of these two particles with respect to other remain constant; i.e. unlike the two "ends of a train" which were described in this/my answer to the question about "an accelerating and shrinking train" (PSE/a/63110).