In entry.getPrev/Next navigation, show entries from a specific category only
Try this

// Assuming you have named portfolio group for 2D and 3D as portfolio

// .first() if craft2, .one() if craft3

{% set category = craft.categories.group('portfolio').title('2D').first() %}
{% set params = craft.entries({
   section: 'portfolio',
   relatedTo: category,
   orderBy: 'postDate desc',
   limit: 10
 }) %}


Ref: https://docs.craftcms.com/v3/dev/element-queries/category-queries.html#example