Is this a theoretical question?
Your broker receives bid/offers from its liquidity providers and, as you say, they can then utilise the best price on both sides to form the basis of their own bid/offer to their clients, the retail traders. They then have a choice of either adding their own margin to this raw spread or quoting the spread as is and charging a commission.
The fact that the bid/offer may come from different LPs is not a problem. How your broker handles your trade depends on what model they are applying. In many cases, they take the opposite side of your trade themselves and no trade is actually done with either LP on the bid or offer side. If the broker is operating STP/ECN type trades then there is effectively a back-to -back trade with the broker in the middle and the risk is passed through to the LP. In these cases, I believe the broker’s net positions with the LPs is netted out via the system used. But I am not sure of how that side of the broker’s business works, i,e, between broker and LPs in STP/ECN. Maybe someone else here is familiar with the broker/LP interface?
This article by Admiral Markets might explain a little more:
The Difference Between an STP and an ECN Forex Broker Explained