This is too long to post in comment.
These are the tests I use to finding ode degree. Could be used to verify your answers. Each list has the ode as first entry, and the degree expected. Some ode's have no defined degree. Feel free to edit this community wiki post and add your own tests to this list.
test1 = {{y'[x] == y[x]^(1/2), 1},
{y'[x] + y''[x] == 0, 1},
{y'[x] + y''[x]^2 == 0, 2},
{y''[x] + y'[x]^(1/2) == y[x], 2},
{(1 + y'[x]^2)^(3/2) == y''[x], 2},
{3*y[x]^2*y'[x]^3 - y''[x] == Sin[x^2], 1},
{Sqrt[1 + y'[x]^2] == y[x]*y'''[x], 2},
{Sqrt[1 + y'[x]^2] == y[x]*y'''[x]^2, 4},
{Sin[y'[x]] + y'''[x] + 3*x == 0, "undefined"},
{Exp[y''[x]] + Sin[x]*y'[x] == 1, "undefined"},
{k*y''[x]^2 == (1 + y''[x]^2)^3, 6},
{x*y''[x]^3*y'[x] - 5*Exp[x]*y''[x] + y[x]*Log[y[x]] == 0, 3},
{2*Log[x]*y'[x]^2 + 7*Cos[x]*y''[x]^4*y'[x]^7 + x*y[x] == 0, 4},
{y[x] - x*y'[x] - 1/(2*y'[x]^2) == 0, 3},
{y''[x] - a*(c + b*x + y[x])*(y'[x]^2 + 1)^(3/2) == 0, 2}
};
To find max derivative (not degree), this is the code I use in case it is needed also.
(*This function getPatterns is thanks to Carl Woll,see https://mathematica.stackexchange.com/questions/151850/using-cases-and-when-to-make-input-a-list-or-not*)
getPatterns[expr_, pat_] :=
Last@Reap[expr /. a : pat :> Sow[a], _, Sequence @@ #2 &];
getMaxOrder[ode_, y_, x_] := Module[{der, n},
der = getPatterns[ode, Derivative[n_][y][x]];
Max[Cases[der, Derivative[n_][y][x] :> n]]
]
This gives against the above tests the following
getMaxOrder[First[#], y, x] & /@ tests
(* {1, 2, 2, 2, 2, 2, 3, 3, 3, 2, 2, 2, 2, 1, 2} *)
The definition of degree used is from Ince book

Update
This test table is based on definition of degree for ode suggested by Michael below which is different from the one in Ince book. So solution based on this definition should be OK also. I've updated the above to reflect this new definition.
test2 = {{y'[x] == y[x]^(1/2), 1},
{y'[x] + y''[x] == 0, 1},
{y'[x] + y''[x]^2 == 0, 2},
{y''[x] + y'[x]^(1/2) == y[x], 1},
{(1 + y'[x]^2)^(3/2) == y''[x], 1},
{3*y[x]^2*y'[x]^3 - y''[x] == Sin[x^2], 1},
{Sqrt[1 + y'[x]^2] == y[x]*y'''[x], 1},
{Sqrt[1 + y'[x]^2] == y[x]*y'''[x]^2, 2},
{Sin[y'[x]] + y'''[x] + 3*x == 0, 1},
{Exp[y''[x]] + Sin[x]*y'[x] == 1, "undefined"},
{k*y''[x]^2 == (1 + y''[x]^2)^3, 6},
{x*y''[x]^3*y'[x] - 5*Exp[x]*y''[x] + y[x]*Log[y[x]] == 0,3},
{2*Log[x]*y'[x]^2 + 7*Cos[x]*y''[x]^4*y'[x]^7 + x*y[x] == 0, 4},
{y[x] - x*y'[x] - 1/(2*y'[x]^2) == 0, "undefined"},
{y''[x] - a*(c + b*x + y[x])*(y'[x]^2 + 1)^(3/2) == 0, 1},
{Cos[y'[x]^2] + y''[x]^2 == 0, 2},
{Cos[y''[x]^2] + y'[x]^2 == 0, "undefined"}
};
(1 + y'[x]^2)^(3/2) == y''[x]? If you say1, then it is wrong answer. It is degree is 2 actually. Why? Because you need first to square both sides to rationalizes all derivatives, which makes it(1 + y'[x]^2)^3 == y''[x]^2and only now you can look at the degree of the ode. It is this step which causes difficulty. It is like making the ode a polynomial in all its derivatives. And a polynomial can only have integer exponents.Distribute[((1 + y'[x]^2)^(3/2) == y''[x])^2, Equal]Another interesting question, is if we can assume that there will have been some manipulations and the (o)(p).d.e will have assumed a certain form – bmf Feb 22 '23 at 08:18Distributeis interesting. I never thought to try it. If this makes all possible cases rational in derivatives, then the rest will be easy now. I have code to find degree of an ode in Mathematica (it is straight forward) , but it assumes all powers on derivatives are rational already and that is why I did not post it. I will try your trick on some test ode's to see if they work on all cases. – Nasser Feb 22 '23 at 08:22Distributeneeds to be tested and properly modified to get the correct power, but I don't see why not. What I mean is that I don't see any immediate problem. Also, thisfoo[expr_] := Max[0, Max[ Cases[expr, Derivative[n_] -> n, Infinity, Heads -> True]]]will get the highest derivative of the expression and as far as I can tell it's consistent - more tests are needed though – bmf Feb 22 '23 at 08:24Distributeexample, you set the power to2manually by inspection. In the code implementation of a solution, ofcourse this step has to be automated. – Nasser Feb 22 '23 at 08:43Distribute– bmf Feb 22 '23 at 08:48