The optimal selection, sizing, and location of small-scale technologies within a grid-connected distributed energy system (DES) can contribute to reducing carbon emissions, consumer costs, and network imbalances. There is a significant lack of studies on how DES designs, especially those with electrified heating systems, impact unbalanced low-voltage distribution networks to which most DES are connected. This is the first study to present an optimisation framework for obtaining discrete technology sizing and selection for grid-connected DES design, while simultaneously considering multiphase optimal power flow (MOPF) constraints to accurately represent unbalanced low-voltage distribution networks. An algorithm is developed to solve the resulting Mixed-Integer Nonlinear Programming (MINLP) formulation. It employs a decomposition based on Mixed-Integer Linear Programming (MILP) and Nonlinear Programming (NLP) and uses integer cuts and complementarity reformulations to obtain discrete designs that are also feasible with respect to the network constraints. A heuristic modification to the original algorithm is also proposed to improve computational speed. Improved formulations for selecting feasible combinations of air source heat pumps (ASHPs) and hot water storage tanks are also presented. Two networks of varying size are used to test the optimisation methods. Designs with electrified heating (ASHPs and tanks) are compared to those with conventional gas boilers. The algorithms outperform one of the existing state-of-the-art commercial deterministic MINLP solvers, which fails to find any solutions in two instances within specified time limits. While feasible solutions were obtained for all cases, convergence was not achieved for all, especially for those involving the larger network. Where converged, the algorithm with the heuristic modification has achieved results up to 70% faster than the original algorithm. Results for case studies suggest that including ASHPs can support up to 16% higher renewable generation capacity compared to gas boilers, albeit with higher ASHP investment costs, as local generation and consumption minimises network violations associated with excess power export. The results also show the importance of including nonlinear power flow constraints in DES design problems. The optimisation framework and results can be used to inform stakeholders such as policymakers and network operators, to increase renewable energy capacity and aid the decarbonisation of domestic heating systems.