  A linear code is said to be self-orthogonal if it is contained in its dual.
Self-orthogonal codes are of interest because of their important applications,
such as for constructing linear complementary dual (LCD) codes and quantum
codes. In this paper, we construct several new families of ternary
self-orthogonal codes by employing weakly regular plateaued functions. Their
parameters and weight distributions are completely determined. Then we apply
these self-orthogonal codes to construct several new families of ternary LCD
codes. As a consequence, we obtain many (almost) optimal ternary
self-orthogonal codes and LCD codes.
