The bike with trailer is always a bit of a connundrum.
Depending on the size of trailer you're talking about, this may work okay. For a larger trailer, I would not recommend it for a number of reasons.
One of critical towing geometries is how far the tow ball is past the bumper. Because it gives the trailer added leverage on the tow vehicle, it compromises a number of things:
1) Tongue weight and porpoising are exascerbated.
2) Sway stability
3) Shifts more load onto the rear axle (and taking more weight off the front axle)
4) Needs more rear spring rate or more WD tension to avoid sag
It also has the perceived effect of reducing the wheelbase, as this compromises the wheelbase to rear overhang ratio.
Not sure what kind of trailer you're talking. I went the route similar to
@coleAK , which has it's own compromises to be aware of. Checkout a Stromberg Carlson Bike Bunk to see if that may work for you?