How to sharpen edges on part of a cylinder
Subdivision surface modifier is our great friend here.

But it has rules: when angles are high we need regular, quad geometry. But for flat surface all is ok for it.

So I propose a solution that has low impact of the other parts of the mesh.

Here is the final result, containing ngons, tris and quads:



The starting point is to add knife cuts on all the selected parts here, as this is the edges we want to harden:



The aim of these cuts is to delimitate the straight angles we want, cutting the less possible, even is we so create non quad faces.

For the bottom part, we can make an edge loop going along the corner shape, but creating a tri (which will be well handled by the subsufr).



So far we have this with a subdiv of 2:



But the top part has irregularities... so we need to modify it.

Again use the knife tool to add this:



And link these parts (still using knife tool):



So far, we have this:



Which can be improved with:



Here is the blend file (only the part you'll see when opening it is 'finished'). But for this part of the model, you can use a mirror modifier.