In the first example, the meaning is the same but the "not necessarily" is more natural.
In the second example, the meaning is actually different (or can be different). "We don't necesssarily do things like that" implies that you might or might not do those kinds of things, depending on circumstances. "We don't have to do things like that" implies that you have no need to do a thing.
Examples: 1. At this school, we sometimes beat the children with a stick. But we don't necessarily do things like that. It depends on how badly the kids behave.
2. We are rich now. We used to ride the bus, but we don't have to do things like that now.