Two-pion Hanbury-Brown-Twiss (HBT) correlations for p+p and central Pb+Pb collisions at the Large-Hadron-Collider (LHC) energies are investigated with the ultrarelativistic quantum molecular dynamics model combined with a correlation afterburner. The transverse momentum dependence of the Pratt-Bertsch HBT radii Rlong, Rout, and Rside is extracted from a three-dimensional Gaussian fit to the correlator in the longitudinal co-moving system. In the p+p case, the dependence of correlations on the charged particle multiplicity and formation time is explored and the data allows to constrain the formation time in the string fragmentation to τf ≤ 0.8 fm/c. In the Pb+Pb case, it is found that Rout is overpredicted by nearly 50%. The LHC results are also compared to data from the STAR experiment at RHIC. For both energies we find that the calculated Rout/Rside ratio is always larger than data, indicating that the emission in the model is less explosive than observed in the data.