If you are taking an existing publication and just tweaking details (e.g.: character names, locations, dialogue), that's not fanfic at all; at best that's an adaptation. If you're creating a parody (and provide proper citations/attributions to the originating work) it may be fair use. More likely, it's still considered plagiarism if you can still recognisably see the concepts, structure and inspiration but do not have the author's permission.
There is no exact percentage for plagiarism, and that is by design in most countries' legal systems. It is about concepts and ideas, and whether a "reasonable person" could make the connection.
Proper fanfic is where you take existing characters and locations, but put them into an entirely new story / scene / context that never happened in the original work, so is considered "original" in that sense.