Quantifying "worse" I mean likelihood of becoming a casualty and severeness of effect of becoming a casualty -with death obviously being the worst outcome. I'm curious because both medical and weapons technology advanced in the 130~ years between the conflict but for the most part soldiers didn't wear armor to protect their torso, arms, and legs.
So this depends on how you define the Napoleonic War time frame, keeping in mind that France was actively at war from 1792 until 1815 with short breaks in between. The wars strictly under Napoleon on Emperor are generally constrained to 1803-1815. If you include casualties from the 11 years prior to Napoleon's rise, which extends the total time of conflict to 5 times that of the Great War, France loses a significantly larger share of their male service-able population. The casualties suffered in these extended conflicts could arguably be seen as responsible for the demographic crunch that left France well below German population as you push into World War 1, as a whole generation was bled out of their male pops.
Now, if you aren't from France, the answer pretty much immediately becomes that its better to be from the Napoleonic Wars. The reasons for this are myriad, no nation used as wide of a conscription pool as France under the Levee en Masse, the wars were pretty much always some form of coalition affair AGAINST france spreading battle casualties among many nations, and each nation had at least some period where truces or nominal subservience to france provided some measure of respite. Spain is arguable as to whether its worse to be in the Napoleonics or the civil war in the lead up to World War 2, though as a share of total pop Napoleonics are definitely the worst.
This, however, is just when looking at your likelihood of dying. The potential for non-lethal injury is something that drastically changes the landscape of the conflict, and as far as I can tell there are no hard statistics on French wounded from the Napoleonic era. There is a collection of studies on the wounded and kill ratio of officers here; https://www.napoleon-series.org/research/abstract/military/army/france/c_casualties.html.
To appreciate the data we have to carry out a comparison of regimental and division layouts between the napoleonic and great war eras. I'll have to earmark this section for later as I'm not finding anything in my personal library with a reliable breakdown of Napoleonic French Divisional composition; as such the ability to draw conclusions from wounded data is weak.
In a more emotional sense the most relevant portion to consider is the time frame we examine. Being in the French Army at the start of the Great War is almost certainly the worst option given the horrendous casualty rates of the battles in the 1914-Verdun period. The emotional and psychological bloodletting that occurred from the constant state of sustained contact and engagement in World War 1 was and is horrifying to the modern observer, and will struggle to be replicated outside of Eastern Front fighting in the second world war with the Soviet Doctrine of constant engagement and contest across no-man's land. Given that the question is where is it best to be an infantryman on average, the answer across a broad spectrum is certainly the Napoleonic era. If you're a french servicemen, its World War 2.
I'll cut myself short here because its very easy to slip into the rabbit hole of the opposite of your question - where is the worst experience of an infantryman in the spread from napoleonics to the second world war?
Good metadata on napoleonics deaths with numerous sources; http://necrometrics.com/wars19c.htm#Napoleonic.
Generic good reading on each of the conflicts is a bit extensive, but that which informed this reply most;
John Keegan's The First World War
Oxford's Illustrated History of World War 1
Gerhard Weinberg's A World at Arms: A Global History of World War II
Lynn's The Bayonets of the Republic: Motivation and Tactics in the Army of Revolutionary France, 1791-94
David G. Chandler's *The Campaigns of Napoleon *
For a more personal read into the experiences I highly recommend digging into the diaries and first hand accounts of the front -
Letters from the Front by Judith Millidge is an excellent cursory overview of this topic though it's far from comprehensive given the raw amount of accounts we have access to.