Abstract: The connection between coding theory and combinatorial $t$-designs is an important research topic at the intersection of coding theory and combinatorics. Let $q=p^m$, where $p$ is an odd prime and $m\geq 2$. In this paper, we investigate a class of linear codes $\mathcal{C}$ over $\mathbb{F}_{q^2}$ and their connection with combinatorial $3$-designs. By analyzing the relevant structural properties of $\mathcal{C}$ and $\mathcal{C}^{\perp}$, we show that the supports of the codewords of every nonzero weight in $\mathcal{C}$ and {the supports of the codewords of weight $4$ in $\mathcal{C}^{\perp}$} form $3$-designs. We further investigate a class of nonlinear codes $\mathcal{C}_2$ associated with $\mathcal{C}$, and prove that the supports of the codewords of every nonzero Hamming weight in $\mathcal{C}_2$ also form $3$-designs. These results identify further classes of linear and nonlinear codes whose codewords support combinatorial $3$-designs. In particular, the nonlinear case provides additional examples of codes supporting $3$-designs, a topic for which relatively few results are currently available. As applications, we construct from $\mathcal{C}^{\perp}$ an entanglement-assisted quantum error-correcting code with parameters $[[q+1,q-3,4;4]]_q$. We also prove that $\mathcal{C}$ is an all-symbol locally repairable code with locality $3$. Furthermore, we show that the code $\mathcal{C}$ {meets the Singleton-type bound for locally repairable codes} and hence is optimal in some cases.