Let $X$ be a smooth irreducible curve (i.e. quasi-projective algebraic variety over $k$ such that all its irreducible components have dimension $1$), and in fact let $X$ be projective. Let $D$ be an effective divisor. I think that $\text{H}^1(X,D)$ (or $\text{H}^1(X,\mathcal{O}_X(D))$, however you prefer) is trivial, but I am not sure if my proof is correct.
We can easily cover $X$ with two affine opens. We denote by $W_1$ and $W_2$ the intersections of these affine opens with $X$. We have the following map: $$\mathcal{O}(D)(W_1)\oplus \mathcal{O}(D)(W_2) \rightarrow \mathcal{O}(D)(W_1\cap W_2)\quad , \quad (g_1,g_2)\mapsto g_1|_{W_1\cap W_2}-g_2|_{W_1\cap W_2}$$ In order to prove that the cohomology group is trivial, I have to prove that this map is sirjective. Now, $g_1\in \mathcal{O}(D)(W_1)$ means that $v_P(g_1)+D(P)\geq 0 $ for every $P\in W_1$. Since $D$ is effective, this means that $g_1$ is a rational function that can have a finite number of poles (more precisely, it can have poles in the support of $D$ of degree at most $D(P)$), and it can have zeroes wherever it wants. The same goes for $g_2$. So in particular, by taking $g_2=0$, I can just produce the whole $\mathcal{O}(D)(W_1\cap W_2)$ with the images of the $g_1$'s, right?
This is false. The property that $H^1(X,O_X(D))$ vanishes for $D$ (not necessarily effective) is called "nonspecial". There are divisors which are special e.g. the canonical divisor on an elliptic curve has $H^1(E,K_E)\cong H^1(E,O_E)\cong k$. So your question boils down to: Are effective divisors nonspecial?
The answer in this case is still no. @Mohan has already given you an answer in the comments, so let me just provide a specific case of it.
Take a degree $d=4$ curve in $\mathbb{P}^2_k$. Then its genus is $g(C)=\frac{3\cdot 2}{2}=3$. Therefore, $H^0(C,K_C)\cong k^3$. One can also compute the canonical divisor in this case via adjunction, $$ K_C=(K_{\mathbb{P}^2_k}+C)|_C=-3H+4H|_C=H|_C. $$ Therefore, $K_C$ is an effective divisor of degree $4$ (you could also see this via $\deg K_C=2g(C)-2$). This is due to Bezout's Theorem i.e. any line will cross $C$ at four points. Now apply Riemann-Roch to $K_C$ to get $$ \chi(C,K_C)=\deg K_C+1-g(C)=2. $$ Therefore, $H^1(C,K_C)$ is one-dimensional.
As for where your argument went wrong, here is the potential issue. Covering by two affine open is fine, this is true. However, your proof of surjectivity is faulty or very handwavy.
Even if you took $g_2=0$, you have no guarantee that you can produce all of $O(D)(W_1\cap W_2)$. What you are claiming is that a rational function in $O(D)(W_1\cap W_2)$ can extend to one in $O(D)(W_1)$. This isn't true because the condition of being a rational function in this smaller open set is in some sense "weaker" than being a rational function on all of $W_1$.
Here's an example. Look at $O(1)$ on $\mathbb{P}^1_k$. Then this has two spanning sections globally: $x_0,x_1$. But if you restrict to an open affine subset $U_0$, you the regular functions you get are all of $k[x_0,x_1,x_2]$.