Logistic regression may be used for classification.
In order to preserve the convex nature for the loss function, a log-loss cost function has been designed for logistic regression. This cost function extremes at labels True and False.
The gradient for the loss function of logistic regression comes out to have the same form of terms as the gradient for the Least Squared Error.
More: https://www.baeldung.com/cs/gradient-descent-logistic-regression