DIVs not showing correctly on CPT?

So it took me nearly 3 days to figure out what was wrong but I narrowed it down after a very exhaustive set of tests. I figured I’d post the answer for my own reference and if, for any reason, someone made the same mistake as I did.

The question I kept asking was “What is different between these two posts?”.

The answer I failed to keep giving myself was “One has tags and one does not”.

Here was the problem code in the content.php file:

<?php if ( has_category() ) : ?>
    <div class="category-links">Category: <?php the_category( ', ' ); ?>
<?php endif; ?>
</div>
<?php if ( has_tag() ) : ?>
    <div class="tag-links"> <?php the_tags( 'Tagged: ', ', ', '<br />' ); ?> 
<?php endif; ?>
</div>

All the posts had categories, but the problem pages did not have tags. The resulting visual output was caused by improperly placed divs that I kept overlooking. When there was no tag, there was an extra causing the overall container to close prematurely, excluding the sidebar that needed to be inside.

Just another case of overlooked simple answers and another chapter in my road to learning web development.