More than 620,000 people died in the Civil War, and that doesn’t include the overall suffering that the war created. The Civil War doesn’t really come into the story of “O Captain! My Captain!” except as it's represented by the ship’s voyage. The suffering in the poem is mostly concerned with the death of the captain. More specifically, it is about the speaker’s suffering over the loss of the captain, his total BFF and personal hero. The contrast between the speaker’s private pain aboard the ship, and the people’s boisterous behavior on the shore, brings into focus how it’s much easier to understand suffering on an individual, rather than a group, level.
“When Lilacs Last in the Door-yard Bloom’d” is a more personal poem because it presents detailed images to the reader, along with the speaker’s feelings toward those images (plus it has flowers in it). "O Captain! My Captain!" leaves out too much detail to be as effective.
We never know how the captain dies because Whitman wrote and published the poem at a specific time when everyone knew exactly what had happened to Lincoln. Nobody needed cluing-in on the backstory.