I know that the Lagrangian of a system has to be dependent on the coordinate (as the type of potential in it is dependent on the coordinate) and on velocity and time (per KE and PE, respectively). This leaves us with a restricted condition for the type of potentials that we can deal with, potentials depend only on time and coordinates, nothing further than that. In detail, one can derive from scratch the following (so called Lagrange's Equation) $$\frac{\mathrm{d}}{\mathrm{d}t}\left(\frac{\partial T}{\partial\dot{q}_i}\right)-\frac{\partial T}{\partial q_i}=Q_i\tag{1}$$ where $q_i$'s are generalized coordinates, $T$ is the kinetic energy, and $Q_j:=F_{i}\frac{\partial x^i}{\partial q^j}$ are generalized forces. (For further detail, here $x^i=x^i(q_1,q_2,q_3,t)$ and $\delta W=F_i \delta x^i$.) Let us assume that force $Q_i$ has potential so that it can be expressed as $$\boxed{Q_i=-\frac{\partial U}{\partial q_i}.}$$ Then $(1)$ can be expressed as $$\begin{align*} \frac{\mathrm{d}}{\mathrm{d}t}\left(\frac{\partial T}{\partial\dot{q}_i}\right)-\frac{\partial T}{\partial q_i}-Q_i&=\frac{\mathrm{d}}{\mathrm{d}t}\left(\frac{\partial T}{\partial\dot{q}_i}\right)-\frac{\partial T}{\partial q_i}+\frac{\partial U}{\partial q_i}\\ &=\frac{\mathrm{d}}{\mathrm{d}t}\left(\frac{\partial T}{\partial\dot{q}_i}\right)-\frac{\partial }{\partial q_i}(T-U)=0\tag{2} \end{align*} $$ and if we restrict $U$ in a way that $\boxed{\frac{\partial U}{\partial \dot{q}_i}=0}$, then we can plug $U$ in $(2)$ as in the following $$\frac{\mathrm{d}}{\mathrm{d}t}\left(\frac{\partial }{\partial\dot{q}_i}(T-U)\right)-\frac{\partial }{\partial q_i}(T-U)=0$$ and finally we get the Euler-Lagrange equation $$\frac{\mathrm{d}}{\mathrm{d}t}\left(\frac{\partial L}{\partial\dot{q}_i}\right)-\frac{\partial L}{\partial q_i}=0$$ where $L=T-U$.
One condition when we came up with this equation is the restriction of the potential function, that it mustn't be velocity dependent. So how one can apply/expand the Lagrangian so that it can describe, say, velocity-dependent (or even with higher order) potential?