A differential equation does NOT have a "dimension". What you are asking about is the dimension of the solution set. And you will need p and q to be continuous in order to use the "existance and uniqueness theorem".
I assume you have seen the proof that the solution set does, in fact, form a vector space. You just need to observe if f and g are solutions, then, for any a and b,
(af+ bg)''+ p(x)(af+ bg)'+ q(x)(af+ bg)= af''+ bg''+ap(x)f'+ bp(x)g'+ aq(x)f+ bq(x)g= a(f''+ pf'+ qf)+ b(g''+ pg'+ qg)= a(0)+ b(0)= 0 so af+ bg is also a in that set.0
To see that "the set of all solutions to a second order, homogeneous, linear differential equation form a vector space of dimension 2", look at the inital value problems y''+ p(x)y'+ q(x)= 0, with y(a)= 1, y'(a)= 0 and with y(a)= 0, y'(a)= 1. Since y''= -p(x)y'- q(x)y, if p and q are continuous on some interval around x= a, then there exist a unique solution to each of those problems on that interval(You also need that f(x, y)= -p(x)y'+ q(x)y be "Lischitz" in y. Since it is differentiable with respect to y, that is clear.). I will call those solutions Y1(x) and Y2(x). If AY1(x)+ BY2(x)= 0 for all x, then, in particular, AY1(a)+ BY2(a)= A= 0. We then have BY2(x)= 0 for all x, and since Y2'(a) is not 0, Y2 is not a constant, so, in particular not 0 for all x, so B= 0. That proves that the two functions, Y1 and Y2, are independent.
Now let y(x) be any solution to the differential equation. Let A= y(a), B= y'(a). Then AY1+ BY2 also satisfies the differential equation and (AY1+ BY2)(a)= AY1(a)+ BY2(a)= A(1)+ B(0)= A and (AY1+ BY2)'(a)= AY1'(a)+ BY2'(a)= A(0)+ B(1)= B. Since AY1+ BY2 satisfies the same differential equation and the same initial conditions, it follows that y(x)= AY1(x)+ BY2(x). That shows that Y1 and Y2 span the space of all solutions so since they are also indepenendent, they form a basis for that space and so it is two dimensional.