This study investigates the truck–cargo matching problem in less-than-truckload (LTL) logistics hubs, focusing on optimizing the three-dimensional loading of goods onto standardized pallets and assigning these loaded pallets to a fleet of heterogeneous vehicles. A two-stage hybrid heuristic algorithm is proposed to solve this complex logistics challenge. In the first stage, a tree search algorithm based on residual space is developed to determine the optimal layout for the 3D loading of cargo onto pallets. In the second stage, a heuristic online truck–cargo matching algorithm is introduced to allocate loaded pallets to trucks while optimizing the number of trucks used and minimizing transportation costs. The algorithm operates within a rolling time horizon, allowing it to dynamically handle real-time order arrivals and time window constraints. Numerical experiments demonstrate that the proposed method achieves high pallet loading efficiency (close to 90%), near-optimal truck utilization (nearly 95%), and significant cost reductions, making it a practical solution for real-world LTL logistics operations.